SHARE
TWEET

Untitled

a guest Sep 15th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top