-
Notifications
You must be signed in to change notification settings - Fork 9
Integrating with existing promise based APIs
Kory Nunn edited this page Sep 2, 2019
·
1 revision
function combineFileAndTweets(file, tweetsResponse, callback){
callback(null, file + tweetsResponse.body)
}
function myTask(callback){
var someFileRighto = righto(fs.readFile, './filePath', 'utf8'); // A righto
var tweetsPromise = got('https://api.twitter.com/1.1/search/tweets.json'); // A Promise
var combinedRighto = righto(combineFileAndTweets, someFileRighto, tweetsPromise); // righto handles both
combinedRighto(callback)
}