Comparing version 2.17.0 to 2.18.0
33
index.js
@@ -7,2 +7,3 @@ const { EventEmitter } = require('events') | ||
const FIFO = require('fast-fifo') | ||
const TextDecoder = require('text-decoder') | ||
@@ -293,3 +294,7 @@ /* eslint-disable no-multi-spaces */ | ||
if (this.map !== null) data = this.map(data) | ||
if (this.map !== null) { | ||
data = this.map(data) | ||
if (data === null) return this.buffered < this.highWaterMark | ||
} | ||
this.buffered += this.byteLength(data) | ||
@@ -691,5 +696,18 @@ this.queue.push(data) | ||
if (opts.eagerOpen) this._readableState.updateNextTick() | ||
if (opts.encoding) this.setEncoding(opts.encoding) | ||
} | ||
} | ||
setEncoding (encoding) { | ||
const dec = new TextDecoder(encoding) | ||
const map = this._readableState.map || echo | ||
this._readableState.map = mapOrSkip | ||
return this | ||
function mapOrSkip (data) { | ||
const next = dec.push(data) | ||
return next === '' ? null : map(next) | ||
} | ||
} | ||
_read (cb) { | ||
@@ -918,2 +936,11 @@ cb(null) | ||
cork () { | ||
this._duplexState |= WRITE_CORKED | ||
} | ||
uncork () { | ||
this._duplexState &= WRITE_NOT_CORKED | ||
this._writableState.updateNextTick() | ||
} | ||
_writev (batch, cb) { | ||
@@ -1078,2 +1105,6 @@ cb(null) | ||
function echo (s) { | ||
return s | ||
} | ||
function isStream (stream) { | ||
@@ -1080,0 +1111,0 @@ return !!stream._readableState || !!stream._writableState |
{ | ||
"name": "streamx", | ||
"version": "2.17.0", | ||
"version": "2.18.0", | ||
"description": "An iteration of the Node.js core streams with a series of improvements", | ||
"main": "index.js", | ||
"dependencies": { | ||
"fast-fifo": "^1.1.0", | ||
"queue-tick": "^1.0.1" | ||
"fast-fifo": "^1.3.2", | ||
"queue-tick": "^1.0.1", | ||
"text-decoder": "^1.1.0" | ||
}, | ||
"devDependencies": { | ||
"b4a": "^1.6.6", | ||
"brittle": "^3.1.1", | ||
@@ -12,0 +14,0 @@ "end-of-stream": "^1.4.4", |
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
50244
937
4
4
+ Addedtext-decoder@^1.1.0
+ Addedtext-decoder@1.2.1(transitive)
Updatedfast-fifo@^1.3.2