@yume-chan/stream-extra 0.0.18 → 0.0.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +33 -21
- package/CHANGELOG.md +8 -2
- package/README.md +1 -1
- package/esm/buffered-transform.d.ts +11 -10
- package/esm/buffered-transform.d.ts.map +1 -1
- package/esm/buffered-transform.js +55 -55
- package/esm/buffered-transform.js.map +1 -1
- package/esm/buffered.d.ts +29 -27
- package/esm/buffered.d.ts.map +1 -1
- package/esm/buffered.js +128 -123
- package/esm/buffered.js.map +1 -1
- package/esm/chunk.d.ts +7 -4
- package/esm/chunk.d.ts.map +1 -1
- package/esm/chunk.js +48 -7
- package/esm/chunk.js.map +1 -1
- package/esm/consumable.d.ts +53 -0
- package/esm/consumable.d.ts.map +1 -0
- package/esm/consumable.js +178 -0
- package/esm/consumable.js.map +1 -0
- package/esm/decode-utf8.d.ts +4 -4
- package/esm/decode-utf8.js +11 -11
- package/esm/distribution.d.ts +24 -0
- package/esm/distribution.d.ts.map +1 -0
- package/esm/distribution.js +99 -0
- package/esm/distribution.js.map +1 -0
- package/esm/duplex.d.ts +48 -47
- package/esm/duplex.d.ts.map +1 -1
- package/esm/duplex.js +90 -92
- package/esm/duplex.js.map +1 -1
- package/esm/gather-string.d.ts +6 -6
- package/esm/gather-string.d.ts.map +1 -1
- package/esm/gather-string.js +15 -13
- package/esm/gather-string.js.map +1 -1
- package/esm/index.d.ts +16 -15
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +16 -15
- package/esm/index.js.map +1 -1
- package/esm/inspect.d.ts +4 -4
- package/esm/inspect.js +11 -11
- package/esm/pipe-from.d.ts +12 -11
- package/esm/pipe-from.d.ts.map +1 -1
- package/esm/pipe-from.js +23 -25
- package/esm/pipe-from.js.map +1 -1
- package/esm/push-readable.d.ts +19 -18
- package/esm/push-readable.d.ts.map +1 -1
- package/esm/push-readable.js +61 -61
- package/esm/push-readable.js.map +1 -1
- package/esm/split-string.d.ts +4 -4
- package/esm/split-string.d.ts.map +1 -1
- package/esm/split-string.js +24 -24
- package/esm/split-string.js.map +1 -1
- package/esm/stream.d.ts +25 -24
- package/esm/stream.d.ts.map +1 -1
- package/esm/stream.js +26 -26
- package/esm/stream.js.map +1 -1
- package/esm/struct-deserialize.d.ts +6 -6
- package/esm/struct-deserialize.d.ts.map +1 -1
- package/esm/struct-deserialize.js +8 -8
- package/esm/struct-serialize.d.ts +5 -5
- package/esm/struct-serialize.js +10 -10
- package/esm/trace.d.ts +3 -3
- package/esm/wrap-readable.d.ts +21 -20
- package/esm/wrap-readable.d.ts.map +1 -1
- package/esm/wrap-readable.js +56 -56
- package/esm/wrap-readable.js.map +1 -1
- package/esm/wrap-writable.d.ts +14 -12
- package/esm/wrap-writable.d.ts.map +1 -1
- package/esm/wrap-writable.js +62 -52
- package/esm/wrap-writable.js.map +1 -1
- package/package.json +7 -6
- package/src/buffered-transform.ts +5 -10
- package/src/buffered.ts +7 -5
- package/src/consumable.ts +281 -0
- package/src/distribution.ts +113 -0
- package/src/duplex.ts +15 -16
- package/src/gather-string.ts +5 -3
- package/src/index.ts +16 -15
- package/src/inspect.ts +1 -1
- package/src/pipe-from.ts +8 -6
- package/src/push-readable.ts +3 -7
- package/src/split-string.ts +5 -2
- package/src/stream.ts +1 -1
- package/src/struct-deserialize.ts +1 -1
- package/src/wrap-readable.ts +5 -5
- package/src/wrap-writable.ts +16 -4
- package/tsconfig.build.tsbuildinfo +1 -1
- package/src/chunk.ts +0 -15
package/esm/duplex.js
CHANGED
|
@@ -1,93 +1,91 @@
|
|
|
1
|
-
import { PromiseResolver } from "@yume-chan/async";
|
|
2
|
-
import { WritableStream
|
|
3
|
-
import { WrapReadableStream } from "./wrap-readable.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
await this.close();
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
async close() {
|
|
64
|
-
if (this._writableClosed) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
this._writableClosed = true;
|
|
68
|
-
// Call `close` first, so it can still write data to `WritableStream`s.
|
|
69
|
-
if ((await this.options.close?.()) !== false) {
|
|
70
|
-
// `close` can return `false` to disable automatic `dispose`.
|
|
71
|
-
await this.dispose();
|
|
72
|
-
}
|
|
73
|
-
for (const writer of this.writers) {
|
|
74
|
-
await writer.close().catch(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
}
|
|
1
|
+
import { PromiseResolver } from "@yume-chan/async";
|
|
2
|
+
import { WritableStream } from "./stream.js";
|
|
3
|
+
import { WrapReadableStream } from "./wrap-readable.js";
|
|
4
|
+
const NOOP = () => {
|
|
5
|
+
// no-op
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* A factory for creating a duplex stream.
|
|
9
|
+
*
|
|
10
|
+
* It can create multiple `ReadableStream`s and `WritableStream`s,
|
|
11
|
+
* when any of them is closed, all other streams will be closed as well.
|
|
12
|
+
*/
|
|
13
|
+
export class DuplexStreamFactory {
|
|
14
|
+
readableControllers = [];
|
|
15
|
+
writers = [];
|
|
16
|
+
_writableClosed = false;
|
|
17
|
+
get writableClosed() {
|
|
18
|
+
return this._writableClosed;
|
|
19
|
+
}
|
|
20
|
+
_closed = new PromiseResolver();
|
|
21
|
+
get closed() {
|
|
22
|
+
return this._closed.promise;
|
|
23
|
+
}
|
|
24
|
+
options;
|
|
25
|
+
constructor(options) {
|
|
26
|
+
this.options = options ?? {};
|
|
27
|
+
}
|
|
28
|
+
wrapReadable(readable) {
|
|
29
|
+
return new WrapReadableStream({
|
|
30
|
+
start: (controller) => {
|
|
31
|
+
this.readableControllers.push(controller);
|
|
32
|
+
return readable;
|
|
33
|
+
},
|
|
34
|
+
cancel: async () => {
|
|
35
|
+
// cancel means the local peer wants to close the connection.
|
|
36
|
+
await this.close();
|
|
37
|
+
},
|
|
38
|
+
close: async () => {
|
|
39
|
+
// stream end means the remote peer closed the connection first.
|
|
40
|
+
await this.dispose();
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
createWritable(stream) {
|
|
45
|
+
const writer = stream.getWriter();
|
|
46
|
+
this.writers.push(writer);
|
|
47
|
+
// `WritableStream` has no way to tell if the remote peer has closed the connection.
|
|
48
|
+
// So it only triggers `close`.
|
|
49
|
+
return new WritableStream({
|
|
50
|
+
write: async (chunk) => {
|
|
51
|
+
await writer.write(chunk);
|
|
52
|
+
},
|
|
53
|
+
abort: async (reason) => {
|
|
54
|
+
await writer.abort(reason);
|
|
55
|
+
await this.close();
|
|
56
|
+
},
|
|
57
|
+
close: async () => {
|
|
58
|
+
await writer.close().catch(NOOP);
|
|
59
|
+
await this.close();
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
async close() {
|
|
64
|
+
if (this._writableClosed) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this._writableClosed = true;
|
|
68
|
+
// Call `close` first, so it can still write data to `WritableStream`s.
|
|
69
|
+
if ((await this.options.close?.()) !== false) {
|
|
70
|
+
// `close` can return `false` to disable automatic `dispose`.
|
|
71
|
+
await this.dispose();
|
|
72
|
+
}
|
|
73
|
+
for (const writer of this.writers) {
|
|
74
|
+
await writer.close().catch(NOOP);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async dispose() {
|
|
78
|
+
this._writableClosed = true;
|
|
79
|
+
this._closed.resolve();
|
|
80
|
+
for (const controller of this.readableControllers) {
|
|
81
|
+
try {
|
|
82
|
+
controller.close();
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
// ignore
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
await this.options.dispose?.();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
93
91
|
//# sourceMappingURL=duplex.js.map
|
package/esm/duplex.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"duplex.js","sourceRoot":"","sources":["../src/duplex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"duplex.js","sourceRoot":"","sources":["../src/duplex.ts"],"names":[],"mappings":"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"}
|
package/esm/gather-string.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WritableStream } from "./stream.js";
|
|
2
|
-
export declare class GatherStringStream extends WritableStream<string> {
|
|
3
|
-
private _result;
|
|
4
|
-
get result(): string;
|
|
5
|
-
constructor();
|
|
6
|
-
}
|
|
1
|
+
import { WritableStream } from "./stream.js";
|
|
2
|
+
export declare class GatherStringStream extends WritableStream<string> {
|
|
3
|
+
private _result;
|
|
4
|
+
get result(): string;
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=gather-string.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gather-string.d.ts","sourceRoot":"","sources":["../src/gather-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,qBAAa,kBAAmB,SAAQ,cAAc,CAAC,MAAM,CAAC;IAE1D,OAAO,CAAC,OAAO,CAAM;IACrB,IAAW,MAAM,
|
|
1
|
+
{"version":3,"file":"gather-string.d.ts","sourceRoot":"","sources":["../src/gather-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,qBAAa,kBAAmB,SAAQ,cAAc,CAAC,MAAM,CAAC;IAE1D,OAAO,CAAC,OAAO,CAAM;IACrB,IAAW,MAAM,WAEhB;;CASJ"}
|
package/esm/gather-string.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { WritableStream } from "./stream.js";
|
|
2
|
-
export class GatherStringStream extends WritableStream {
|
|
3
|
-
// PERF: rope (concat strings) is faster than `[].join('')`
|
|
4
|
-
_result =
|
|
5
|
-
get result() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
1
|
+
import { WritableStream } from "./stream.js";
|
|
2
|
+
export class GatherStringStream extends WritableStream {
|
|
3
|
+
// PERF: rope (concat strings) is faster than `[].join('')`
|
|
4
|
+
_result = "";
|
|
5
|
+
get result() {
|
|
6
|
+
return this._result;
|
|
7
|
+
}
|
|
8
|
+
constructor() {
|
|
9
|
+
super({
|
|
10
|
+
write: (chunk) => {
|
|
11
|
+
this._result += chunk;
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
}
|
|
14
16
|
//# sourceMappingURL=gather-string.js.map
|
package/esm/gather-string.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gather-string.js","sourceRoot":"","sources":["../src/gather-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,OAAO,kBAAmB,SAAQ,cAAsB;IAC1D,2DAA2D;IACnD,OAAO,GAAG,EAAE,CAAC;IACrB,IAAW,MAAM,
|
|
1
|
+
{"version":3,"file":"gather-string.js","sourceRoot":"","sources":["../src/gather-string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,OAAO,kBAAmB,SAAQ,cAAsB;IAC1D,2DAA2D;IACnD,OAAO,GAAG,EAAE,CAAC;IACrB,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;QACI,KAAK,CAAC;YACF,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;gBACb,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC;YAC1B,CAAC;SACJ,CAAC,CAAC;IACP,CAAC;CACJ"}
|
package/esm/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
1
|
+
export * from "./buffered-transform.js";
|
|
2
|
+
export * from "./buffered.js";
|
|
3
|
+
export * from "./consumable.js";
|
|
4
|
+
export * from "./decode-utf8.js";
|
|
5
|
+
export * from "./distribution.js";
|
|
6
|
+
export * from "./duplex.js";
|
|
7
|
+
export * from "./gather-string.js";
|
|
8
|
+
export * from "./inspect.js";
|
|
9
|
+
export * from "./pipe-from.js";
|
|
10
|
+
export * from "./push-readable.js";
|
|
11
|
+
export * from "./split-string.js";
|
|
12
|
+
export * from "./stream.js";
|
|
13
|
+
export * from "./struct-deserialize.js";
|
|
14
|
+
export * from "./struct-serialize.js";
|
|
15
|
+
export * from "./wrap-readable.js";
|
|
16
|
+
export * from "./wrap-writable.js";
|
|
16
17
|
//# sourceMappingURL=index.d.ts.map
|
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
1
|
+
export * from "./buffered-transform.js";
|
|
2
|
+
export * from "./buffered.js";
|
|
3
|
+
export * from "./consumable.js";
|
|
4
|
+
export * from "./decode-utf8.js";
|
|
5
|
+
export * from "./distribution.js";
|
|
6
|
+
export * from "./duplex.js";
|
|
7
|
+
export * from "./gather-string.js";
|
|
8
|
+
export * from "./inspect.js";
|
|
9
|
+
export * from "./pipe-from.js";
|
|
10
|
+
export * from "./push-readable.js";
|
|
11
|
+
export * from "./split-string.js";
|
|
12
|
+
export * from "./stream.js";
|
|
13
|
+
export * from "./struct-deserialize.js";
|
|
14
|
+
export * from "./struct-serialize.js";
|
|
15
|
+
export * from "./wrap-readable.js";
|
|
16
|
+
export * from "./wrap-writable.js";
|
|
16
17
|
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
|
package/esm/inspect.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TransformStream } from "./stream.js";
|
|
2
|
-
export declare class InspectStream<T> extends TransformStream<T, T> {
|
|
3
|
-
constructor(callback: (value: T) => void);
|
|
4
|
-
}
|
|
1
|
+
import { TransformStream } from "./stream.js";
|
|
2
|
+
export declare class InspectStream<T> extends TransformStream<T, T> {
|
|
3
|
+
constructor(callback: (value: T) => void);
|
|
4
|
+
}
|
|
5
5
|
//# sourceMappingURL=inspect.d.ts.map
|
package/esm/inspect.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { TransformStream } from "./stream.js";
|
|
2
|
-
export class InspectStream extends TransformStream {
|
|
3
|
-
constructor(callback) {
|
|
4
|
-
super({
|
|
5
|
-
transform(chunk, controller) {
|
|
6
|
-
callback(chunk);
|
|
7
|
-
controller.enqueue(chunk);
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
}
|
|
1
|
+
import { TransformStream } from "./stream.js";
|
|
2
|
+
export class InspectStream extends TransformStream {
|
|
3
|
+
constructor(callback) {
|
|
4
|
+
super({
|
|
5
|
+
transform(chunk, controller) {
|
|
6
|
+
callback(chunk);
|
|
7
|
+
controller.enqueue(chunk);
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
12
|
//# sourceMappingURL=inspect.js.map
|
package/esm/pipe-from.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @param
|
|
9
|
-
* @
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import type { ReadableWritablePair } from "./stream.js";
|
|
2
|
+
import { WritableStream } from "./stream.js";
|
|
3
|
+
/**
|
|
4
|
+
* Pipe `pair.readable` to `writable`, then returns `pair.writable`.
|
|
5
|
+
*
|
|
6
|
+
* This is the opposite of `ReadableStream#pipeThrough()`.
|
|
7
|
+
*
|
|
8
|
+
* @param writable The `WritableStream` to write to.
|
|
9
|
+
* @param pair A `TransformStream` that converts chunks.
|
|
10
|
+
* @returns `pair`'s `writable` stream.
|
|
11
|
+
*/
|
|
12
|
+
export declare function pipeFrom<W, T>(writable: WritableStream<W>, pair: ReadableWritablePair<W, T>): import("web-streams-polyfill").WritableStream<T>;
|
|
12
13
|
//# sourceMappingURL=pipe-from.d.ts.map
|
package/esm/pipe-from.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipe-from.d.ts","sourceRoot":"","sources":["../src/pipe-from.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"pipe-from.d.ts","sourceRoot":"","sources":["../src/pipe-from.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EACzB,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,EAC3B,IAAI,EAAE,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,oDAanC"}
|
package/esm/pipe-from.js
CHANGED
|
@@ -1,26 +1,24 @@
|
|
|
1
|
-
import { WritableStream } from "./stream.js";
|
|
2
|
-
/**
|
|
3
|
-
* Pipe `pair.readable` to `writable`, then returns `pair.writable`.
|
|
4
|
-
*
|
|
5
|
-
* This is the opposite of `ReadableStream#pipeThrough()`.
|
|
6
|
-
*
|
|
7
|
-
* @param writable The `WritableStream` to write to.
|
|
8
|
-
* @param pair A `TransformStream` that converts chunks.
|
|
9
|
-
* @returns `pair`'s `writable` stream.
|
|
10
|
-
*/
|
|
11
|
-
export function pipeFrom(writable, pair) {
|
|
12
|
-
const writer = pair.writable.getWriter();
|
|
13
|
-
const pipe = pair.readable
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
}
|
|
1
|
+
import { WritableStream } from "./stream.js";
|
|
2
|
+
/**
|
|
3
|
+
* Pipe `pair.readable` to `writable`, then returns `pair.writable`.
|
|
4
|
+
*
|
|
5
|
+
* This is the opposite of `ReadableStream#pipeThrough()`.
|
|
6
|
+
*
|
|
7
|
+
* @param writable The `WritableStream` to write to.
|
|
8
|
+
* @param pair A `TransformStream` that converts chunks.
|
|
9
|
+
* @returns `pair`'s `writable` stream.
|
|
10
|
+
*/
|
|
11
|
+
export function pipeFrom(writable, pair) {
|
|
12
|
+
const writer = pair.writable.getWriter();
|
|
13
|
+
const pipe = pair.readable.pipeTo(writable);
|
|
14
|
+
return new WritableStream({
|
|
15
|
+
async write(chunk) {
|
|
16
|
+
await writer.write(chunk);
|
|
17
|
+
},
|
|
18
|
+
async close() {
|
|
19
|
+
await writer.close();
|
|
20
|
+
await pipe;
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
}
|
|
26
24
|
//# sourceMappingURL=pipe-from.js.map
|
package/esm/pipe-from.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipe-from.js","sourceRoot":"","sources":["../src/pipe-from.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pipe-from.js","sourceRoot":"","sources":["../src/pipe-from.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CACpB,QAA2B,EAC3B,IAAgC;IAEhC,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5C,OAAO,IAAI,cAAc,CAAI;QACzB,KAAK,CAAC,KAAK,CAAC,KAAK;YACb,MAAM,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;QACD,KAAK,CAAC,KAAK;YACP,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;YACrB,MAAM,IAAI,CAAC;QACf,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
package/esm/push-readable.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import type { AbortSignal, QueuingStrategy } from "./stream.js";
|
|
2
|
+
import { ReadableStream } from "./stream.js";
|
|
3
|
+
export interface PushReadableStreamController<T> {
|
|
4
|
+
abortSignal: AbortSignal;
|
|
5
|
+
enqueue(chunk: T): Promise<void>;
|
|
6
|
+
close(): void;
|
|
7
|
+
error(e?: unknown): void;
|
|
8
|
+
}
|
|
9
|
+
export type PushReadableStreamSource<T> = (controller: PushReadableStreamController<T>) => void | Promise<void>;
|
|
10
|
+
export declare class PushReadableStream<T> extends ReadableStream<T> {
|
|
11
|
+
/**
|
|
12
|
+
* Create a new `PushReadableStream` from a source.
|
|
13
|
+
*
|
|
14
|
+
* @param source If `source` returns a `Promise`, the stream will be closed
|
|
15
|
+
* when the `Promise` is resolved, and be errored when the `Promise` is rejected.
|
|
16
|
+
* @param strategy
|
|
17
|
+
*/
|
|
18
|
+
constructor(source: PushReadableStreamSource<T>, strategy?: QueuingStrategy<T>);
|
|
19
|
+
}
|
|
19
20
|
//# sourceMappingURL=push-readable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"push-readable.d.ts","sourceRoot":"","sources":["../src/push-readable.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"push-readable.d.ts","sourceRoot":"","sources":["../src/push-readable.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAmB,cAAc,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,WAAW,4BAA4B,CAAC,CAAC;IAC3C,WAAW,EAAE,WAAW,CAAC;IAEzB,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjC,KAAK,IAAI,IAAI,CAAC;IAEd,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI,CACtC,UAAU,EAAE,4BAA4B,CAAC,CAAC,CAAC,KAC1C,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,qBAAa,kBAAkB,CAAC,CAAC,CAAE,SAAQ,cAAc,CAAC,CAAC,CAAC;IACxD;;;;;;OAMG;gBAEC,MAAM,EAAE,wBAAwB,CAAC,CAAC,CAAC,EACnC,QAAQ,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;CA+DpC"}
|