Sha256: 8ca1330b37e00f33c9731d0be5f166f72fb2069423b2aa9a3866ae6332404d47
Contents?: true
Size: 664 Bytes
Versions: 93
Compression:
Stored size: 664 Bytes
Contents
var ReadStream = require('fs').ReadStream var Stream = require('stream') module.exports = function destroy(stream) { if (stream instanceof ReadStream) { return destroyReadStream(stream) } if (!(stream instanceof Stream)) { return stream } if (typeof stream.destroy === 'function') { stream.destroy() } return stream } function destroyReadStream(stream) { stream.destroy() if (typeof stream.close === 'function') { // node.js core bug work-around stream.on('open', onopenClose) } return stream } function onopenClose() { if (typeof this.fd === 'number') { // actually close down the fd this.close() } }
Version data entries
93 entries across 93 versions & 5 rubygems