Module

std/node/_stream/duplex.ts>default

Deno standard library
Go to Latest
class default
extends Stream
import { default } from "https://dotland.deno.dev/std@0.116.0/node/_stream/duplex.ts";

A duplex is an implementation of a stream that has both Readable and Writable attributes and capabilities

Constructors

new
default(options?: DuplexOptions)

Properties

optional
_final: (callback: (error?: Error | null | undefined) => void) => void
_readableState: ReadableState
_writableState: WritableState
optional
_writev: writeV | null
allowHalfOpen: boolean
destroyed: boolean
off
readable: boolean
readonly
readableBuffer
readonly
readableEncoding
readonly
readableEnded
readableFlowing: boolean | null
readonly
readableHighWaterMark: number
readonly
readableLength
readonly
readableObjectMode
writable
readonly
writableBuffer
readonly
writableCorked
readonly
writableEnded
readonly
writableFinished
readonly
writableHighWaterMark
readonly
writableLength
readonly
writableObjectMode

Methods

_destroy(error: Error | null, callback: (error?: Error | null) => void): void
_read(size?: number)
_write(
chunk: any,
encoding: string,
cb: (error?: Error | null) => void,
): void
destroy(err?: Error | null, cb?: (error?: Error | null) => void)
end(cb?: () => void): void
end(chunk: any, cb?: () => void): void
end(
chunk: any,
encoding: Encodings,
cb?: () => void,
): void
end(
x?: any | (() => void),
y?: Encodings | (() => void),
z?: () => void,
)
on(event:
| "close"
| "end"
| "pause"
| "readable"
| "resume"
, listener: () => void
): this
on(event: "data", listener: (chunk: any) => void): this
on(event: "error", listener: (err: Error) => void): this
on(event: string | symbol, listener: (...args: any[]) => void): this
on(ev: string | symbol, fn:
| (() => void)
| ((chunk: any) => void)
| ((err: Error) => void)
| ((...args: any[]) => void)
)
pause(): this
pipe<T extends Duplex | Writable>(dest: T, pipeOpts?: { end?: boolean; }): T
push(chunk: any, encoding?: Encodings): boolean
read(n?: number)

You can override either this method, or the async _read method

removeAllListeners(ev:
| "close"
| "data"
| "end"
| "error"
| "pause"
| "readable"
| "resume"
| symbol
| undefined
)
removeListener(event:
| "close"
| "end"
| "pause"
| "readable"
| "resume"
, listener: () => void
): this
removeListener(event: "data", listener: (chunk: any) => void): this
removeListener(event: "error", listener: (err: Error) => void): this
removeListener(event: string | symbol, listener: (...args: any[]) => void): this
removeListener(ev: string | symbol, fn:
| (() => void)
| ((chunk: any) => void)
| ((err: Error) => void)
| ((...args: any[]) => void)
): this
resume(): this
setDefaultEncoding(encoding: string)
unpipe(dest?: Writable): this
unshift(chunk: any, encoding?: Encodings): boolean
wrap(stream: Stream): this
write(
chunk: any,
x?: WritableEncodings | null | ((error: Error | null | undefined) => void),
y?: ((error: Error | null | undefined) => void),
)