stream-chopper
Advanced tools
Comparing version 1.0.0 to 1.1.0
17
index.js
@@ -60,2 +60,10 @@ 'use strict' | ||
StreamChopper.prototype.chop = function (cb) { | ||
if (this._destroyed) { | ||
if (cb) process.nextTick(cb) | ||
return | ||
} | ||
this._endStream(cb) | ||
} | ||
StreamChopper.prototype._startStream = function (cb) { | ||
@@ -104,3 +112,6 @@ if (this._destroyed) return | ||
if (this._destroyed) return | ||
if (this._stream === null) return process.nextTick(cb) | ||
if (this._stream === null) { | ||
if (cb) process.nextTick(cb) | ||
return | ||
} | ||
@@ -115,3 +126,3 @@ const stream = this._stream | ||
stream.end(cb) | ||
} else { | ||
} else if (cb) { | ||
process.nextTick(cb) | ||
@@ -198,3 +209,3 @@ } | ||
}) | ||
stream.destroy() // TODO: Should I listen for `error` even though I'm not passing in an error to destroy()? | ||
stream.destroy() | ||
} else { | ||
@@ -201,0 +212,0 @@ this.emit('close') |
{ | ||
"name": "stream-chopper", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Chop a single stream of data into a series of readable streams", | ||
@@ -47,5 +47,5 @@ "main": "index.js", | ||
"coordinates": [ | ||
55.777379, | ||
12.592166 | ||
55.777427, | ||
12.592209 | ||
] | ||
} |
@@ -116,2 +116,12 @@ # stream-chopper | ||
### `chopper.chop([callback])` | ||
Manually chop the stream. Forces the current output stream to end even | ||
if its `size` limit or `time` timeout hasn't been reached yet. | ||
Arguments: | ||
- `callback` - An optional callback which will be called once the output | ||
stream have ended | ||
## License | ||
@@ -118,0 +128,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12105
178
132