title: How to create a Duplex stream in nodejs?
body: <p>I create a new Duplex stream like this</p>
  
  <pre><code>const Duplex = require('stream').Duplex;
  let myStream = new Duplex()
  </code></pre>
  
  <p>Via a Websocket I receive chunks/buffer which  I add to the stream like this every time a new chunk comes in via the Websocket:</p>
  
  <p><code>myStream.push(buffer)</code></p>
  
  <p>I then pipe the stream to another process (ffmpeg in this example)</p>
  
  <p><code>myStream.pipe(process.stdout);
  </code>
  This causes the error <code>NodeError: The _read() method is not implemented</code> which I understand but I don't understand why and how I should implement it. I also see that in the Duplex class constructor you can pass a read function, but why is this neccessary? I just wanna continuously push chunks into the stream and then pipe it to another process</p>