File
Blob: src/node/stream.ts
| 1 | // Copyright (c) 2017-2022 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | // |
| 5 | |
| 6 | import { pipeline } from 'node-internal:streams_pipeline'; |
| 7 | import { addAbortSignal } from 'node-internal:streams_add_abort_signal'; |
| 8 | import { eos } from 'node-internal:streams_end_of_stream'; |
| 9 | import { |
| 10 | isErrored, |
| 11 | isDisturbed, |
| 12 | isDestroyed, |
| 13 | isReadable, |
| 14 | isWritable, |
| 15 | } from 'node-internal:streams_util'; |
| 16 | import { destroyer } from 'node-internal:streams_destroy'; |
| 17 | import { |
| 18 | getDefaultHighWaterMark, |
| 19 | setDefaultHighWaterMark, |
| 20 | } from 'node-internal:streams_state'; |
| 21 | import { compose } from 'node-internal:streams_compose'; |
| 22 | import { Stream } from 'node-internal:streams_legacy'; |
| 23 | import { Writable } from 'node-internal:streams_writable'; |
| 24 | import { Readable } from 'node-internal:streams_readable'; |
| 25 | import { Duplex, duplexPair } from 'node-internal:streams_duplex'; |
| 26 | import { Transform, PassThrough } from 'node-internal:streams_transform'; |
| 27 | import { promises } from 'node-internal:streams_promises'; |
| 28 | |
| 29 | // eslint-disable-next-line @typescript-eslint/unbound-method |
| 30 | export const _isArrayBufferView = Stream._isArrayBufferView; |
| 31 | // eslint-disable-next-line @typescript-eslint/unbound-method |
| 32 | export const _isUint8Array = Stream._isUint8Array; |
| 33 | // eslint-disable-next-line @typescript-eslint/unbound-method |
| 34 | export const _uint8ArrayToBuffer = Stream._uint8ArrayToBuffer; |
| 35 | const destroy = destroyer; |
| 36 | const finished = eos; |
| 37 | |
| 38 | export { |
| 39 | addAbortSignal, |
| 40 | compose, |
| 41 | destroy, |
| 42 | finished, |
| 43 | isErrored, |
| 44 | isDisturbed, |
| 45 | isReadable, |
| 46 | pipeline, |
| 47 | Stream, |
| 48 | Writable, |
| 49 | Readable, |
| 50 | Duplex, |
| 51 | Transform, |
| 52 | PassThrough, |
| 53 | promises, |
| 54 | getDefaultHighWaterMark, |
| 55 | setDefaultHighWaterMark, |
| 56 | isDestroyed, |
| 57 | isWritable, |
| 58 | duplexPair, |
| 59 | }; |
| 60 | |
| 61 | // @ts-expect-error TS2322 Type incompatibility between internal and Node.js stream types |
| 62 | Stream.addAbortSignal = addAbortSignal; |
| 63 | Stream.compose = compose; |
| 64 | Stream.destroy = destroy; |
| 65 | // @ts-expect-error TS2741 __promisify__ is missing. |
| 66 | Stream.finished = finished; |
| 67 | Stream.isReadable = isReadable; |
| 68 | // @ts-expect-error TS2322 Type incompatibility between internal and Node.js stream types |
| 69 | Stream.isWritable = isWritable; |
| 70 | Stream.isErrored = isErrored; |
| 71 | Stream.isDisturbed = isDisturbed; |
| 72 | Stream.pipeline = pipeline; |
| 73 | Stream.Stream = Stream; |
| 74 | // @ts-expect-error TS2419 Type incompatibility due to exactOptionalPropertyTypes |
| 75 | Stream.Writable = Writable; |
| 76 | // @ts-expect-error TS2419 Type incompatibility due to exactOptionalPropertyTypes |
| 77 | Stream.Readable = Readable; |
| 78 | Stream.Duplex = Duplex; |
| 79 | // @ts-expect-error TS2419 Type incompatibility due to exactOptionalPropertyTypes |
| 80 | Stream.Transform = Transform; |
| 81 | Stream.PassThrough = PassThrough; |
| 82 | // @ts-expect-error TS2322 Type incompatibility due to exactOptionalPropertyTypes |
| 83 | Stream.promises = promises; |
| 84 | Stream.getDefaultHighWaterMark = getDefaultHighWaterMark; |
| 85 | Stream.setDefaultHighWaterMark = setDefaultHighWaterMark; |
| 86 | Stream.isDestroyed = isDestroyed; |
| 87 | Stream.duplexPair = duplexPair; |
| 88 | |
| 89 | export default Stream; |