1 var ReadStream = require('fs').ReadStream
2 var Stream = require('stream')
4 module.exports = function destroy(stream) {
5 if (stream instanceof ReadStream) {
6 return destroyReadStream(stream)
9 if (!(stream instanceof Stream)) {
13 if (typeof stream.destroy === 'function') {
20 function destroyReadStream(stream) {
23 if (typeof stream.close === 'function') {
24 // node.js core bug work-around
25 stream.on('open', onopenClose)
31 function onopenClose() {
32 if (typeof this.fd === 'number') {
33 // actually close down the fd