title: Creating a Node.js Readable stream from a JavaScript object — The simplest possible way
body: <p>Can anyone explain why I'm getting an error after running the following code with node v0.10.21?</p>
  
  <p>I'm aware that I could JSON.stringify() that object in order to achieve more or less the same result, the point here is to make sense of stream.Readable when objectMode is set true.</p>
  
  <p><strong>The error:</strong></p>
  
  <pre><code>net.js:612
      throw new TypeError('invalid data');
            ^
  TypeError: invalid data
      at WriteStream.Socket.write (net.js:612:11)
      at write (_stream_readable.js:583:24)
      at flow (_stream_readable.js:592:7)
      at _stream_readable.js:560:7
      at process._tickCallback (node.js:415:13)
      at Function.Module.runMain (module.js:499:11)
      at startup (node.js:119:16)
      at node.js:901:3
  </code></pre>
  
  <p><strong>The code:</strong></p>
  
  <pre><code>var stream = require('stream');
  var edad = require(__dirname + '/public/edad.json');
  
  var rs = new stream.Readable({ objectMode: true });
  
  rs.push(edad);
  rs.push(null);
  rs.pipe(process.stdout);
  </code></pre>