Skip to content

Instantly share code, notes, and snippets.

@Raynos
Created July 16, 2013 00:52
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 Raynos/6004892 to your computer and use it in GitHub Desktop.
Save Raynos/6004892 to your computer and use it in GitHub Desktop.
var Readable = require("stream").Readable
function ArrayStream(list) {
var r = Readable({ objectMode: true })
r._read = function () {
do {
var item = list.shift() || null
} while (r.push(list.shift())
}
return r
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment