🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

stream-slice

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-slice - npm Package Compare versions

Comparing version

to
0.1.2

22

index.js

@@ -23,12 +23,22 @@

SliceStream.prototype._transform = function(chunk, encoding, done) {
var offset = this._offset + chunk.length;
if (!this._emitUp && offset >= this._start) {
this._offset += chunk.length;
if (!this._emitUp && this._offset >= this._start) {
this._emitUp = true;
this.push(chunk.slice(chunk.length - (offset - this._start), this._end));
var start = chunk.length - (this._offset - this._start);
if(this._offset > this._end)
{
var end = chunk.length - (this._offset - this._end);
this._emitDown = true;
this.push(chunk.slice(start, end));
}
else
{
this.push(chunk.slice(start, chunk.length));
}
return done();
}
if (this._emitUp && !this._emitDown) {
if (offset >= this.end) {
if (this._offset >= this._end) {
this._emitDown = true;
this.push(chunk.slice(chunk.length - (offset - this._end)));
this.push(chunk.slice(0, chunk.length - (this._offset - this._end)));
} else {

@@ -39,3 +49,3 @@ this.push(chunk);

}
done();
return done();
}

@@ -42,0 +52,0 @@

{
"name": "stream-slice",
"version": "0.1.1",
"version": "0.1.2",
"description": "slice stream like buffer/string",

@@ -5,0 +5,0 @@ "main": "index.js",