Skip to content

Instantly share code, notes, and snippets.

@timoxley
Created May 30, 2013 08:02
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 timoxley/5676388 to your computer and use it in GitHub Desktop.
Save timoxley/5676388 to your computer and use it in GitHub Desktop.
probably need to pause?
from = require('from')
through = require('through')
concat = require('concat-stream')
from([1,2,3,4,5])
.pipe(through(function(data) {
setTimeout(function(){
console.log('pushing data', data)
this.push(data)
}.bind(this), 300)
})).pipe(through(function(data) {
console.log('pushing data second time', data);
this.push(data)
})).pipe(concat(function(result) {
console.log("voila", result)
}))
@timoxley
Copy link
Author

output:

voila undefined
pushing data 1
pushing data 2
pushing data 3
pushing data 4
pushing data 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment