Skip to main content

WriteStream

class WriteStream
extends stream.Writable
  • Extends stream.Writable

Instances of fs.WriteStream are created and returned using the createWriteStream function.

Properties Jump to heading

The number of bytes written so far. Does not include data that is still queued for writing.

Jump to headingpath: string | Buffer

The path to the file the stream is writing to as specified in the first argument to createWriteStream. If path is passed as a string, thenwriteStream.path will be a string. If path is passed as a Buffer, thenwriteStream.path will be a Buffer.

This property is true if the underlying file has not been opened yet, i.e. before the 'ready' event is emitted.

Jump to headingaddListener(
event: "close",
listener: () => void,
): this

events.EventEmitter

  1. open
  2. close
  3. ready
Jump to headingaddListener(
event: "drain",
listener: () => void,
): this
Jump to headingaddListener(
event: "error",
listener: (err: Error) => void,
): this
Jump to headingaddListener(
event: "finish",
listener: () => void,
): this
Jump to headingaddListener(
event: "open",
listener: (fd: number) => void,
): this
Jump to headingaddListener(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
Jump to headingaddListener(
event: "ready",
listener: () => void,
): this
Jump to headingaddListener(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
Jump to headingaddListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
Jump to headingclose(callback?: (err?: ErrnoException | null) => void): void

Closes writeStream. Optionally accepts a callback that will be executed once the writeStreamis closed.

Jump to headingon(
event: "close",
listener: () => void,
): this
Jump to headingon(
event: "drain",
listener: () => void,
): this
Jump to headingon(
event: "error",
listener: (err: Error) => void,
): this
Jump to headingon(
event: "finish",
listener: () => void,
): this
Jump to headingon(
event: "open",
listener: (fd: number) => void,
): this
Jump to headingon(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
Jump to headingon(
event: "ready",
listener: () => void,
): this
Jump to headingon(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
Jump to headingon(
event: string | symbol,
listener: (...args: any[]) => void,
): this
Jump to headingonce(
event: "close",
listener: () => void,
): this
Jump to headingonce(
event: "drain",
listener: () => void,
): this
Jump to headingonce(
event: "error",
listener: (err: Error) => void,
): this
Jump to headingonce(
event: "finish",
listener: () => void,
): this
Jump to headingonce(
event: "open",
listener: (fd: number) => void,
): this
Jump to headingonce(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
Jump to headingonce(
event: "ready",
listener: () => void,
): this
Jump to headingonce(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
Jump to headingonce(
event: string | symbol,
listener: (...args: any[]) => void,
): this
Jump to headingprependListener(
event: "close",
listener: () => void,
): this
Jump to headingprependListener(
event: "drain",
listener: () => void,
): this
Jump to headingprependListener(
event: "error",
listener: (err: Error) => void,
): this
Jump to headingprependListener(
event: "finish",
listener: () => void,
): this
Jump to headingprependListener(
event: "open",
listener: (fd: number) => void,
): this
Jump to headingprependListener(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
Jump to headingprependListener(
event: "ready",
listener: () => void,
): this
Jump to headingprependListener(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
Jump to headingprependListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
Jump to headingprependOnceListener(
event: "close",
listener: () => void,
): this
Jump to headingprependOnceListener(
event: "drain",
listener: () => void,
): this
Jump to headingprependOnceListener(
event: "error",
listener: (err: Error) => void,
): this
Jump to headingprependOnceListener(
event: "finish",
listener: () => void,
): this
Jump to headingprependOnceListener(
event: "open",
listener: (fd: number) => void,
): this
Jump to headingprependOnceListener(
event: "pipe",
listener: (src: stream.Readable) => void,
): this
Jump to headingprependOnceListener(
event: "ready",
listener: () => void,
): this
Jump to headingprependOnceListener(
event: "unpipe",
listener: (src: stream.Readable) => void,
): this
Jump to headingprependOnceListener(
event: string | symbol,
listener: (...args: any[]) => void,
): this
Back to top