Skip to content

Instantly share code, notes, and snippets.

@rao123dk
Created September 4, 2019 16:48
Show Gist options
  • Save rao123dk/6f92d59555d6c5053cbdd26e7edba457 to your computer and use it in GitHub Desktop.
Save rao123dk/6f92d59555d6c5053cbdd26e7edba457 to your computer and use it in GitHub Desktop.
const { Readable } = require('stream');
function bufferToStream(binary) {
const readableInstanceStream = new Readable({
read() {
this.push(binary);
this.push(null);
}
});
return readableInstanceStream;
}
//
let bdata =Buffer.from("Hello, how are you?","utf-8")
let streamdata = bufferToStream(bdata);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment