pump
Advanced tools
Comparing version 0.1.0 to 0.1.1
10
index.js
var once = require('once'); | ||
var noop = function() {}; | ||
var patch = function(stream, onend) { // patch 0.8 stream since they dont emit finish | ||
var end = stream.end; | ||
stream.end = function() { | ||
onend(); | ||
end.apply(this, arguments); | ||
}; | ||
}; | ||
var destroyer = function(stream, callback) { | ||
@@ -33,2 +41,4 @@ var ended = false; | ||
if (!stream._readableState && stream.writable) patch(stream, onend); | ||
return destroy; | ||
@@ -35,0 +45,0 @@ }; |
{ | ||
"name": "pump", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"repository": "git://github.com/mafintosh/pump.git", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
# pump | ||
pump is a small node module that pipes streams together and destroy them if one of them closes. | ||
pump is a small node module that pipes streams together and destroys all of them if one of them closes. | ||
npm install pump | ||
## What problem does it solve? | ||
When using standard `source.pipe(dest)` source will _not_ be destroyed if dest emits close or an error. | ||
@@ -46,2 +48,2 @@ You are also not able to provide a callback to tell when then pipe has finished. | ||
MIT | ||
MIT |
4011
90
49