Last active
August 29, 2015 14:11
-
-
Save myndzi/ceed78129e56950d2000 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async.auto({ | |
get_data: function(callback){ | |
callback(null, 'data', 'converted to array'); | |
}, | |
make_folder: function(callback){ | |
callback(null, 'folder'); | |
}, | |
write_file: ['get_data', 'make_folder', function(callback, results){ | |
callback(null, 'filename'); | |
}], | |
email_link: ['write_file', function(callback, results){ | |
callback(null, {'file':results.write_file, 'email':'[email protected]'}); | |
}] | |
}, function(err, results) { | |
console.log('err = ', err); | |
console.log('results = ', results); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getData = getDataAsync(); | |
var makeFolder = makeFolderAsync(); | |
var writeFile = Promise.all([ | |
getData, | |
makeFolder | |
]).spread(writeFileAsync); | |
var emailLink = writeFile.then(emailLinkAsync); | |
emailLink.then(function (results) { | |
console.log('results =', results); | |
}).catch(function (err) { | |
console.log('err =', err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment