ignoreStream.js 352 B

1234567891011121314151617
  1. // @ts-check
  2. "use strict";
  3. /**
  4. * Safely ignores a Node.js readable stream.
  5. * @param {import("stream").Readable} stream Node.js readable stream.
  6. */
  7. function ignoreStream(stream) {
  8. // Prevent an unhandled error from crashing the process.
  9. stream.on("error", () => {});
  10. // Waste the stream.
  11. stream.resume();
  12. }
  13. module.exports = ignoreStream;