Created
February 16, 2012 05:54
-
-
Save nakamura-to/1842456 to your computer and use it in GitHub Desktop.
nue with CoffeeScript
This file contains 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
nue = require('nue') | |
flow = nue.flow | |
parallel = nue.parallel | |
fs = require('fs') | |
flow( | |
parallel( | |
-> fs.readFile('path1', 'utf-8', @async()) | |
-> fs.readFile('path2', 'utf-8', @async())) | |
(results) -> fs.writeFile('path3', results[0] + results[1], @async()); | |
-> fs.readFile('path3', 'utf-8', @async()); | |
(data) -> | |
if @err? then throw @err | |
console.log(data) | |
console.log('all done') | |
@next() | |
)() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment