Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

std/node/stream.ts>Writable

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
class Writable
extends Stream
Re-export
import { Writable } from "https://deno.land/std@0.101.0/node/stream.ts";

A bit simpler than readable streams. Implement an async ._write(chunk, encoding, cb), and it'll handle all the drain event emission and buffering.

Constructors

new
Writable(options?: WritableOptions)

Properties

optional
_final: (this: Writable, callback: (error?: Error | null | undefined) => void) => void
_writableState: WritableState
optional
_writev: writeV | null
destroyed
writable
readonly
writableBuffer
readonly
writableCorked
readonly
writableEnded
readonly
writableFinished
readonly
writableHighWaterMark
readonly
writableLength
readonly
writableObjectMode

Methods

_destroy(err: Error | null, cb: (error?: Error | null) => void)
_write(
chunk: any,
encoding: string,
cb: (error?: Error | null) => void,
): void
destroy(err?: Error | null, cb?: () => void)
end(cb?: () => void): void
end(chunk: any, cb?: () => void): void
end(
chunk: any,
encoding: WritableEncodings,
cb?: () => void,
): void
pipe(dest: Writable): Writable
setDefaultEncoding(encoding: string)
write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean
write(
chunk: any,
encoding: WritableEncodings | null,
cb?: (error: Error | null | undefined) => void,
): boolean

Static Properties

WritableState