Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function asyncInsertMagFromFile(file, resolve) {
- //some asynchronous processing with file
- resolve();
- }
- let magRequests = fs.readdirSync(storeDir).map(function(file) {
- return new Promise(resolve => {
- asyncInsertMagFromFile(file, resolve);
- });
- });
- (async function loop() {
- fs.readdirSync(storeDir).forEach(function(file) {
- await new Promise(resolve =>
- asyncInsertMagFromFile(file, resolve)
- );
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement