Skip to content

Instantly share code, notes, and snippets.

@alcovegan
Created July 8, 2017 14:08
Show Gist options
  • Select an option

  • Save alcovegan/bb21d9f0760d992b677108cec13e9452 to your computer and use it in GitHub Desktop.

Select an option

Save alcovegan/bb21d9f0760d992b677108cec13e9452 to your computer and use it in GitHub Desktop.
const async = require('async');
const request = require('axios');
function iteratee(asset, cb) {
request
.get(`construct url with asset here`)
.then(function(res) {
cb(null, params);
})
.catch(err => {
cb(null, params);
})
}
async.mapLimit(assetsList, 10, iteratee, function(err, results) {
if (err) throw err;
fs.writeFile('results.json', JSON.stringify(results), 'utf8', (err) => {
console.log('File with results written!');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment