title: When to compress files with Node.js
body: <p>I'm trying to better understand the static file serving process in Node.js.  I think I have a pretty good handle on everything with the exception of file compression. Many references seem to imply that you should compress files on the fly. Express seems to use this approach in its <a href="https://github.com/expressjs/compression" rel="nofollow">compression</a> middleware.</p>
  
  <p>Given the <a href="https://nodejs.org/api/zlib.html#zlib_memory_usage_tuning" rel="nofollow">memory / time</a> concerns associated with compressing files and the static nature of the files to be compressed, why would you compress these on the fly rather than compressing them as part of a build step or something like that?  Am I missing something?</p>