title: Node Stream - Make sync to return array when stream is done.
body: <p>I wrote this function to extract a file list from a stream. It works, however the stream is async and the <code>files</code> array is returned before the stream is done. I don't really want to use a promise library...trying to keep the code light as possible. How can I return the <code>files</code> array after the stream is completed? </p>
  
  <pre><code>function fileList(source) {
      var files = [];
      source.pipe(through2.obj(function(obj, enc, next) {
          file = obj.history[0].split("/").pop();
          files.push(file);
          next();
      }));
  
      return files;
  }
  </code></pre>