title: What's the proper way to handle back-pressure in a node.js Transform stream?
body: <p>##Intro
  These are my first adventures in writing the node.js server side. It's been
  fun so far but I'm having some difficulty understanding the proper way
  to implement something as it relates to node.js streams.</p>
  <p>###Problem
  For test and learning purposes I'm working with large files whose
  content is zlib compressed. The compressed content is binary data, each
  <em>packet</em> being 38 bytes in length. I'm trying to create a resulting file
  that looks almost identical to the original file except that there is an
  uncompressed 31-byte header for every 1024 38-byte <em>packets</em>.</p>
  <p>###original file content (decompressed)</p>
  <pre><code>+----------+----------+----------+----------+
  | packet 1 | packet 2 |  ......  | packet N |
  | 38 bytes | 38 bytes |  ......  | 38 bytes |
  +----------+----------+----------+----------+
  </code></pre>
  <p>###resulting file content</p>
  <pre><code>+----------+--------------------------------+----------+--------------------------------+
  | header 1 |    1024 38 byte packets        | header 2 |    1024 38 byte packets        |
  | 31 bytes |       zlib compressed          | 31 bytes |       zlib compressed          |
  +----------+--------------------------------+----------+--------------------------------+
  </code></pre>
  <p>As you can see, it's somewhat of a translation problem. This means, I'm
  taking some source stream as input and then slightly transforming it
  into some output stream. Therefore, it felt natural to implement a
  <a href="http://nodejs.org/api/stream.html#stream_class_stream_transform" rel="nofollow noreferrer">Transform stream</a>.</p>
  <p>The class simply attempts to accomplish the following:</p>
  <ol>
  <li>Takes stream as input</li>
  <li>zlib inflates the chunks of data to count the number of packets,
  putting together 1024 of them, zlib deflating, and
  prepending a header.</li>
  <li>Passes the new resulting chunk on through the pipeline via
  <code>this.push(chunk)</code>.</li>
  </ol>
  <p>A use case would be something like:</p>
  <pre><code>var fs = require('fs');
  var me = require('./me'); // Where my Transform stream code sits
  var inp = fs.createReadStream('depth_1000000');
  var out = fs.createWriteStream('depth_1000000.out');
  inp.pipe(me.createMyTranslate()).pipe(out);
  </code></pre>
  <p>###Question(s)
  Assuming <strong>Transform</strong> is a good choice for this use case, I seem to be
  running into a possible back-pressure issue. My call to <code>this.push(chunk)</code>
  within <code>_transform</code> keeps returning <code>false</code>. Why would this be and how
  to handle such things?</p>