Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. const { Readable } = require('stream');
  2.  
  3. function bufferToStream(binary) {
  4. const readableInstanceStream = new Readable({
  5. read() {
  6. this.push(binary);
  7. this.push(null);
  8. }
  9. });
  10. return readableInstanceStream;
  11. }
  12.  
  13.  
  14. //
  15. let bdata =Buffer.from("Hello, how are you?","utf-8")
  16. let streamdata = bufferToStream(bdata);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement