bandcamp-scraper icon indicating copy to clipboard operation
bandcamp-scraper copied to clipboard

Support Promise

Open masterT opened this issue 7 years ago • 2 comments
trafficstars

masterT avatar Nov 24 '17 03:11 masterT

var getAlbumInfo = util.promisify(bandcamp.getAlbumInfo);

async function getCollection(albums, res){
  var ps = albums.map(album => getAlbumInfo(album));
  return Promise.all(ps).then(collection => res.json(collection));
}

notchris avatar Dec 24 '17 09:12 notchris

@notchris Thanks I didn't know about the util.promisify function of the Standard Lib. I'll use it! 😀

masterT avatar Jan 15 '18 13:01 masterT