Comparing version 2.11.3 to 2.12.0
@@ -606,2 +606,3 @@ const { EventEmitter } = require('events') | ||
if (opts.read) this._read = opts.read | ||
if (opts.eagerOpen) this.resume().pause() | ||
} | ||
@@ -608,0 +609,0 @@ } |
{ | ||
"name": "streamx", | ||
"version": "2.11.3", | ||
"version": "2.12.0", | ||
"description": "An iteration of the Node.js core streams with a series of improvements", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -113,3 +113,4 @@ # streamx | ||
byteLength: (data) => size, // optional function that calculates the byte size of input data | ||
signal: abortController.signal // optional AbortSignal that triggers `.destroy` when on `abort` | ||
signal: abortController.signal, // optional AbortSignal that triggers `.destroy` when on `abort` | ||
eagerOpen: false // eagerly open the stream | ||
} | ||
@@ -116,0 +117,0 @@ ``` |
@@ -66,2 +66,33 @@ const tape = require('tape') | ||
tape('lazy open', async function (t) { | ||
let opened = false | ||
const r = new Readable({ | ||
open (cb) { | ||
opened = true | ||
cb(null) | ||
} | ||
}) | ||
await nextImmediate() | ||
t.notOk(opened) | ||
r.push(null) | ||
await nextImmediate() | ||
t.ok(opened) | ||
t.end() | ||
}) | ||
tape('eager open', async function (t) { | ||
let opened = false | ||
const r = new Readable({ | ||
open (cb) { | ||
opened = true | ||
cb(null) | ||
}, | ||
eagerOpen: true | ||
}) | ||
await nextImmediate() | ||
t.ok(opened) | ||
r.push(null) | ||
t.end() | ||
}) | ||
tape('shorthands', function (t) { | ||
@@ -68,0 +99,0 @@ t.plan(3 + 1) |
Sorry, the diff of this file is not supported yet
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
66795
1792
464