title: Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close in Node Pipeline stream
body: <p>I am using the <code>stream.pipeline</code> functionality from Node to upload some data to S3. The basic idea I'm implementing is pulling files from a request and writing them to S3. I have one <code>pipeline</code> that pulls zip files and writes them to S3 successfully. However, I want my second <code>pipeline</code> to make the same request, but unzip and write the unzipped files to S3. The pipeline code looks like the following:</p>
  
  <pre><code>pipeline(request.get(...), s3Stream(zipFileWritePath)),
  pipeline(request.get(...), new unzipper.Parse(), etl.map(entry =&gt; entry.pipe(s3Stream(createWritePath(writePath, entry)))))
  </code></pre>
  
  <p>The s3Stream function looks like so:</p>
  
  <pre><code>function s3Stream(file) {
      const pass = new stream.PassThrough()
      s3Store.upload(file, pass)
      return pass
  }
  </code></pre>
  
  <p>The first <code>pipeline</code> works well, and is currently operating greatly in production. However, when adding the second pipeline, I get the following error:</p>
  
  <pre><code>Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
  at Parse.onclose (internal/streams/end-of-stream.js:56:36)
  at Parse.emit (events.js:187:15)
  at Parse.EventEmitter.emit (domain.js:442:20)
  at Parse.&lt;anonymous&gt; (/node_modules/unzipper/lib/parse.js:28:10)
  at Parse.emit (events.js:187:15)
  at Parse.EventEmitter.emit (domain.js:442:20)
  at finishMaybe (_stream_writable.js:641:14)
  at afterWrite (_stream_writable.js:481:3)
  at onwrite (_stream_writable.js:471:7)
  at /node_modules/unzipper/lib/PullStream.js:70:11
  at afterWrite (_stream_writable.js:480:3)
  at process._tickCallback (internal/process/next_tick.js:63:19)
  </code></pre>
  
  <p>Any idea what could be causing this or solutions to resolve this would be greatly appreciated!</p>