tree-stream
Advanced tools
Comparing version 1.0.15 to 1.1.0
@@ -24,3 +24,3 @@ import { Duplex, Readable, Writable } from 'stream' | ||
node: TreeNode | ||
finish(callback?: Callback, pipe?: Readable): Writable | ||
finish(callback?: Callback, pipe?: ReadableStreamTree): Writable | ||
joinReadable(siblings: number): [WritableStreamTree, ReadableStreamTree[]] | ||
@@ -37,7 +37,7 @@ joinWritable(siblings: Writable[], callback?: Callback[]): WritableStreamTree | ||
const pumpReadable: <X extends unknown>(stream: ReadableStreamTree, resolveValue: X) => Promise<X> | ||
const pumpWritable: <X extends unknown>(stream: WritableStreamTree, resolveValue: X, readable?: Readable) => Promise<X> | ||
const pumpWritable: <X extends unknown>(stream: WritableStreamTree, resolveValue: X, readable?: ReadableStreamTree) => Promise<X> | ||
const finishReadable: <X extends unknown>(stream: ReadableStreamTree, resolve: (x: X) => void, reject: (err: Error) => void, resolveValue?: X) => Readable | ||
const finishWritable: <X extends unknown>(stream: WritableStreamTree, resolve: (x: X) => void, reject: (err: Error) => void, resolveValue?: X, readable?: Readable) => Writable | ||
const finishWritable: <X extends unknown>(stream: WritableStreamTree, resolve: (x: X) => void, reject: (err: Error) => void, resolveValue?: X, readable?: ReadableStreamTree) => Writable | ||
} | ||
export = StreamTree |
10
index.js
@@ -218,8 +218,6 @@ var once = require('once') | ||
// Finalize tree structure and return stream.Writable. | ||
var finish = function(finalNode, callback, stream) { | ||
var finish = function(finalNode, callback, readNode) { | ||
if (callback) terminalNode.callback = callback | ||
var readNode | ||
if (stream) { | ||
readNode = createNode(stream) | ||
if (readNode) { | ||
readNode.childNode.push(finalNode) | ||
@@ -232,3 +230,3 @@ finalNode.parentNode = readNode | ||
addDestroyer(readNode, true, false) | ||
stream.pipe(finalNode.stream) | ||
readNode.stream.pipe(finalNode.stream) | ||
} | ||
@@ -243,3 +241,3 @@ | ||
handle.node = node | ||
handle.finish = function(callback, stream) { return finish(node, callback, stream) } | ||
handle.finish = function(callback, readHandle) { return finish(node, callback, readHandle ? readHandle.node : undefined) } | ||
handle.joinReadable = function(siblings, newPassThrough) { return joinReadable(node, siblings, newPassThrough) } | ||
@@ -246,0 +244,0 @@ handle.joinWritable = function(siblings, callback) { return joinWritable(node, siblings, callback) } |
{ | ||
"name": "tree-stream", | ||
"version": "1.0.15", | ||
"version": "1.1.0", | ||
"repository": "git://github.com/wholenews/tree-stream", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -1,2 +0,2 @@ | ||
# tree-stream | ||
# tree-stream ![image](https://img.shields.io/npm/v/tree-stream) [![test](https://github.com/wholebuzz/tree-stream/actions/workflows/test.yaml/badge.svg)](https://github.com/wholebuzz/tree-stream/actions/workflows/test.yaml) | ||
@@ -56,3 +56,3 @@ tree-stream is a small node module that pipes streams together and destroys all of them if one of them closes. | ||
```typescript | ||
const returnValue = await pumpWritable(writable, 'any return value', readable.finish()) | ||
const returnValue = await pumpWritable(writable, 'any return value', readable) | ||
``` | ||
@@ -59,0 +59,0 @@ |
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
20959
9
406