"use strict"; const warn = require("./warn"); module.exports = function destroyStream(stream) { // TODO: Do we need to detach any event handlers prior to destroying streams? ref. https://www.npmjs.com/package/yauzl: // "You must unpipe() the readStream from any destination before calling readStream.destroy()." if (typeof stream.destroy === "function") { stream.destroy(); } else { warn("The stream you are converting does not have a 'destroy' method, and could therefore not be destroyed. This may cause resource leaks!"); } };