masterT / bandcamp-scraper

A scraper for https://bandcamp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Promise

masterT opened this issue · comments

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 Thanks I didn't know about the util.promisify function of the Standard Lib.
I'll use it! 😀