adbkit
Advanced tools
Comparing version 2.8.0 to 2.8.1
@@ -16,4 +16,4 @@ var LineTransform, Stream, | ||
this.autoDetect = options.autoDetect || false; | ||
this.checkedFirstByte = false; | ||
this.transformNeeded = true; | ||
this.skipBytes = 0; | ||
delete options.autoDetect; | ||
@@ -29,9 +29,20 @@ LineTransform.__super__.constructor.call(this, options); | ||
LineTransform.prototype._transform = function(chunk, encoding, done) { | ||
var hi, last, lo; | ||
if (!this.checkedFirstByte) { | ||
var hi, last, lo, skip; | ||
if (this.autoDetect) { | ||
if (chunk[0] === 0x0a) { | ||
this.transformNeeded = false; | ||
this.skipBytes = 1; | ||
} else { | ||
this.skipBytes = 2; | ||
} | ||
this.checkedFirstByte = true; | ||
this.autoDetect = false; | ||
} | ||
if (this.skipBytes) { | ||
skip = Math.min(chunk.length, this.skipBytes); | ||
chunk = chunk.slice(skip); | ||
this.skipBytes -= skip; | ||
} | ||
if (!chunk.length) { | ||
return done(); | ||
} | ||
if (!this.transformNeeded) { | ||
@@ -38,0 +49,0 @@ return this._nullTransform(chunk, encoding, done); |
{ | ||
"name": "adbkit", | ||
"version": "2.8.0", | ||
"version": "2.8.1", | ||
"description": "A pure Node.js client for the Android Debug Bridge.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
221646
4438