title: Nodejs - streaming readable & writable misunderstood
body: <p>I run a node server and have the following code:</p>
  
  <pre><code>var readable = fs.createReadStream(__dirname + '/greet.txt',
  {encoding: 'utf8', highWaterMark: 332 * 1024});
  </code></pre>
  
  <p>greet.txt:</p>
  
  <pre><code>hello
  </code></pre>
  
  <p>I am having trouble understanding readable stream and writeable stream; 
  In my code above, I have a readable stream which reads from greet.txt -
  chunks enter the buffer and I can see the binary data... the issue is,
  shouldn't there be a writable stream which sends data to my buffer on the other side? how binary data start flying all of the sudden into my buffer, It's just not clear. </p>
  
  <p>Here is a combination of readable and writable:</p>
  
  <pre><code>var readable = fs.createReadStream(__dirname + '/greet.txt',
  {encoding: 'utf8', highWaterMark: 332 * 1024});
  
  var writeable = fs.createWriteStream(__dirname + '/greetcopy.txt');
  
  readable.on('data', function(chunk){
  writeable.write(chunk);
  });
  </code></pre>
  
  <p>as a chunk arrives to readable buffer, and being sent to writable stream's buffer through an event, shouldn't the writable stream be readable too in order to receive the data? and once the writable stream's buffer gets the info from the readable and sends it to greetcopy.txt file(which is empty), how does the data arrive?</p>
  
  <p>the concept of readable and writable in node are over-simplified and I just have hard time grasping them. Thank you for your time, I'd like some info on what's going on behind the scenes...</p>