Created
February 10, 2014 00:20
-
-
Save terinjokes/8908191 to your computer and use it in GitHub Desktop.
Showing an example readable stream created from a string
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
var Readable = require('stream').Readable | |
module.exports = function string2Stream(string) { | |
var stream = new Readbale(); | |
stream._read = function() { | |
//todo: you might want to return data based on the 'size' parameter. | |
stream.push(string); | |
string = null; | |
} | |
return stream; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment