Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async function asyncForEach(array, callback) {
- for (let index = 0; index < array.length; index++) {
- await callback(array[index], index, array);
- }
- }
- async function processSimulations(from: string, to: string) {
- const files = fs
- .readdirSync(from)
- .filter(f => f.endsWith('.json'))
- asyncForEach(files, async (f) => {
- console.log(f)
- const input = loadSimulation(path.join(from, f))
- const transformed = transform(input)
- storeResults(path.join(to, f), transformed)
- })
- }
- processSimulations('data/jsons', 'public/jsons')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement