// Standard Input is piped to a gzip stream. The gzip stream is piped into a file stream. setInterval(function(){ gzip.flush(); // Flush every now and then, so the file is actually written to disk. Otherwise compression happens in memory only. }, 100);