Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Raynos

Raynos/s.js Secret

Created April 11, 2013 20:36
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/3c8812c0262b5ee0493b to your computer and use it in GitHub Desktop.
Save Raynos/3c8812c0262b5ee0493b to your computer and use it in GitHub Desktop.
function S(s) {
var _read = s.read
s.read = function read(callback) {
var chunk = _read.call(s)
if (chunk === null) {
s.once('readable', read)
} else {
cb(null, chunk)
}
}
return s
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment