youtube-node
youtube-node copied to clipboard
Convert it to promise base
Hi, I'm using this wonderful API and it worked perfectly. But I need it to be promise base as my whole application is promise base and this API return result few second late and script doesn't stop for it and bypass it. Is there a way I use it as promise base? Thanks!
You can use the library with the ES6 Promise
class or some of the promise similar libraries for pre ES6 environments; e.g.:
var promise = new Promise(function(resolve, reject) {
Youtube.search('bla bla', 2, function(err, result) {
resolve(result)
}
})