Skip to content

Instantly share code, notes, and snippets.

@nakamura-to
Created February 16, 2012 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nakamura-to/1842456 to your computer and use it in GitHub Desktop.
Save nakamura-to/1842456 to your computer and use it in GitHub Desktop.
nue with CoffeeScript
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