/
_stream.mjs
78 lines (70 loc) · 2.17 KB
/
_stream.mjs
1
2
3
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
import { _uint8ArrayToBuffer } from "./internal/streams/_utils.ts";
import { addAbortSignal } from "./internal/streams/add-abort-signal.mjs";
import { destroyer } from "./internal/streams/destroy.mjs";
import { isDisturbed } from "./internal/streams/utils.mjs";
import { isUint8Array } from "./internal/util/types.ts";
import { pipeline } from "./internal/streams/pipeline.mjs";
import { promisify } from "./internal/util.mjs";
import { Stream } from "./internal/streams/legacy.mjs";
import compose from "./internal/streams/compose.mjs";
import Duplex from "./internal/streams/duplex.mjs";
import eos from "./internal/streams/end-of-stream.mjs";
import PassThrough from "./internal/streams/passthrough.mjs";
import promises from "./stream/promises.mjs";
import Readable from "./internal/streams/readable.mjs";
import Transform from "./internal/streams/transform.mjs";
import Writable from "./internal/streams/writable.mjs";
const { custom: customPromisify } = promisify;
Stream.isDisturbed = isDisturbed;
Stream.Readable = Readable;
Stream.Writable = Writable;
Stream.Duplex = Duplex;
Stream.Transform = Transform;
Stream.PassThrough = PassThrough;
Stream.pipeline = pipeline;
Stream.addAbortSignal = addAbortSignal;
Stream.finished = eos;
Stream.destroy = destroyer;
Stream.compose = compose;
Object.defineProperty(Stream, "promises", {
configurable: true,
enumerable: true,
get() {
return promises;
},
});
Object.defineProperty(pipeline, customPromisify, {
enumerable: true,
get() {
return promises.pipeline;
},
});
Object.defineProperty(eos, customPromisify, {
enumerable: true,
get() {
return promises.finished;
},
});
// Backwards-compat with node 0.4.x
Stream.Stream = Stream;
Stream._isUint8Array = isUint8Array;
Stream._uint8ArrayToBuffer = _uint8ArrayToBuffer;
export default Stream;
export {
_uint8ArrayToBuffer,
addAbortSignal,
compose,
destroyer as destroy,
Duplex,
eos as finished,
isDisturbed,
isUint8Array as _isUint8Array,
PassThrough,
pipeline,
Readable,
Stream,
Transform,
Writable,
};