diff options
author | Steven Guerrero <stephenguerrero43@gmail.com> | 2020-11-26 07:50:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-26 13:50:08 +0100 |
commit | 9042fcc12e7774cdd0ca3a5d08918a07dae8102b (patch) | |
tree | 8b5ff11412aae9bb714e0bb0b9b0358db64a8657 /std/node/_stream/stream.ts | |
parent | 60e980c78180ee3b0a14d692307be275dc181c8d (diff) |
feat(std/node/stream): Add Duplex, Transform, Passthrough, pipeline, finished and promises (#7940)
Diffstat (limited to 'std/node/_stream/stream.ts')
-rw-r--r-- | std/node/_stream/stream.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/std/node/_stream/stream.ts b/std/node/_stream/stream.ts index 708b8bcd3..4daafc77b 100644 --- a/std/node/_stream/stream.ts +++ b/std/node/_stream/stream.ts @@ -1,6 +1,7 @@ // Copyright Node.js contributors. All rights reserved. MIT License. import { Buffer } from "../buffer.ts"; import EventEmitter from "../events.ts"; +import type Readable from "./readable.ts"; import type Writable from "./writable.ts"; import { types } from "../util.ts"; @@ -12,7 +13,7 @@ class Stream extends EventEmitter { static _isUint8Array = types.isUint8Array; static _uint8ArrayToBuffer = (chunk: Uint8Array) => Buffer.from(chunk); - pipe(dest: Writable, options: { end: boolean }) { + pipe(dest: Readable | Writable, options?: { end?: boolean }) { // deno-lint-ignore no-this-alias const source = this; @@ -31,7 +32,8 @@ class Stream extends EventEmitter { if (didOnEnd) return; didOnEnd = true; - dest.end(); + // 'end' is only called on Writable streams + (dest as Writable).end(); } function onclose() { |