Module

std/node/fs.ts>WriteStream

Deno standard library
Go to Latest
class WriteStream
import { WriteStream } from "https://deno.land/std@0.166.0/node/fs.ts";
  • Extends stream.Writable

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

Properties

bytesWritten: number

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

path: 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.

pending: boolean

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

Methods

addListener(event: "close", listener: () => void): this

events.EventEmitter

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

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

on(event: "close", listener: () => void): this
on(event: "drain", listener: () => void): this
on(event: "error", listener: (err: Error) => void): this
on(event: "finish", listener: () => void): this
on(event: "open", listener: (fd: number) => void): this
on(event: "pipe", listener: (src: stream.Readable) => void): this
on(event: "ready", listener: () => void): this
on(event: "unpipe", listener: (src: stream.Readable) => void): this
on(event: string | symbol, listener: (...args: any[]) => void): this
once(event: "close", listener: () => void): this
once(event: "drain", listener: () => void): this
once(event: "error", listener: (err: Error) => void): this
once(event: "finish", listener: () => void): this
once(event: "open", listener: (fd: number) => void): this
once(event: "pipe", listener: (src: stream.Readable) => void): this
once(event: "ready", listener: () => void): this
once(event: "unpipe", listener: (src: stream.Readable) => void): this
once(event: string | symbol, listener: (...args: any[]) => void): this
prependListener(event: "close", listener: () => void): this
prependListener(event: "drain", listener: () => void): this
prependListener(event: "error", listener: (err: Error) => void): this
prependListener(event: "finish", listener: () => void): this
prependListener(event: "open", listener: (fd: number) => void): this
prependListener(event: "pipe", listener: (src: stream.Readable) => void): this
prependListener(event: "ready", listener: () => void): this
prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this
prependListener(event: string | symbol, listener: (...args: any[]) => void): this
prependOnceListener(event: "close", listener: () => void): this
prependOnceListener(event: "drain", listener: () => void): this
prependOnceListener(event: "error", listener: (err: Error) => void): this
prependOnceListener(event: "finish", listener: () => void): this
prependOnceListener(event: "open", listener: (fd: number) => void): this
prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this
prependOnceListener(event: "ready", listener: () => void): this
prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this
prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
import WriteStream
import { WriteStream } from "https://deno.land/std@0.166.0/node/fs.ts";