Members
(constant) ReadPolicy :string
Defines the available read policies.
Type:
- string
Properties:
Name | Type | Description |
---|---|---|
flowing |
string | Reads are done concurrently using 'data' events. |
least |
string | Reads from the stream which has output the least data, measured in
bytes/chars for non-objectMode or values for
objectMode . |
none |
string | No reads are done. When using this readPolicy, be sure to either add
'data' to events, add other 'data' listeners,
.read() the data elsewhere, or call .resume() on
the streams so that the data will be read and 'end' can be
reached. |
Methods
makeIncremental(compareData, compareEventsnullable) → {function}
Makes an incremental comparison and reduction function from a comparison
function.
Given a function which compares output data (e.g.
assert.deepStrictEqual
), this function returns an incremental
comparison function which compares only the amount of data output by both
streams (unless the stream has ended, in which case all remaining data is
compared) and removes the compared data if no comparison result is
returned/thrown.
@ template CompareResult
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
compareData |
function | Data comparison function which will be called with data output by each stream. | |
compareEvents |
function |
<nullable> |
Events comparison function which will be called with the events output by each stream. |
- Source:
Returns:
Incremental
comparison function which compares the stream states using
compareData
and compareEvents
, and removes
compared values if no result is reached.
- Type
- function
streamCompare(stream1non-null, stream2non-null, optionsOrCompare) → {StreamComparePromise.<CompareResult>}
Compares the output of two Readable streams.
@ template CompareResult
Parameters:
Name | Type | Description |
---|---|---|
stream1 |
stream.Readable | First stream to compare. |
stream2 |
stream.Readable | Second stream to compare. |
optionsOrCompare |
!StreamCompareOptions.<CompareResult> | function | Options, or a comparison function (as described in options.compare). |
Returns:
A
Promise
with
the comparison result or error.
- Type
- StreamComparePromise.<CompareResult>