Class WriteStream

Hierarchy

  • Writable
    • WriteStream

Implements

  • WriteStream

Constructors

  • Parameters

    • Optionalopts: WritableOptions

    Returns WriteStream

Properties

_readableState: ReadableState
_writableState: WritableState
[asyncDispose]: never
bytesWritten: number

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

v0.4.7

closed: boolean
destroyed: boolean
errored: null | Error
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.

v0.1.93

pending: boolean

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

v11.2.0

readable: boolean
readableFlowing: null | boolean
readableHighWaterMark: number
readableLength: number
writable: boolean
writableCorked: never
writableEnded: never
writableFinished: never
writableHighWaterMark: number
writableLength: number
writableNeedDrain: boolean
writableObjectMode: never

Methods

  • Parameters

    • error: null | Error
    • callback: ((error: null | Error) => void)
        • (error): void
        • Parameters

          • error: null | Error

          Returns void

    Returns void

  • Parameters

    • callback: ((error?: null | Error) => void)
        • (error?): void
        • Parameters

          • Optionalerror: null | Error

          Returns void

    Returns void

  • Parameters

    • size: number

    Returns void

  • Returns void

  • Parameters

    • chunk: any
    • encoding: string
    • callback: ((error?: null | Error) => void)
        • (error?): void
        • Parameters

          • Optionalerror: null | Error

          Returns void

    Returns void

  • Parameters

    • chunks: {
          chunk: any;
          encoding: string;
      }[]
    • callback: ((error?: null | Error) => void)
        • (error?): void
        • Parameters

          • Optionalerror: null | Error

          Returns void

    Returns void

  • Returns AsyncIterableIterator<any>

  • Event emitter The defined events on documents including:

    1. close
    2. drain
    3. error
    4. finish
    5. pipe
    6. unpipe

    Parameters

    • event: "close"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Event emitter The defined events on documents including:

    1. close
    2. data
    3. end
    4. readable
    5. error

    Parameters

    • event: "drain"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Event emitter The defined events on documents including:

    1. close
    2. data
    3. end
    4. readable
    5. error

    Parameters

    • event: "error"
    • listener: ((err: Error) => void)
        • (err): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Event emitter The defined events on documents including:

    1. close
    2. data
    3. end
    4. readable
    5. error

    Parameters

    • event: "finish"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Event emitter The defined events on documents including:

    1. close
    2. data
    3. end
    4. readable
    5. error

    Parameters

    • event: "pipe"
    • listener: ((src: Readable) => void)
        • (src): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Event emitter The defined events on documents including:

    1. close
    2. data
    3. end
    4. readable
    5. error

    Parameters

    • event: "unpipe"
    • listener: ((src: Readable) => void)
        • (src): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Event emitter The defined events on documents including:

    1. close
    2. data
    3. end
    4. readable
    5. error

    Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args): void
        • Parameters

          • Rest...args: any[]

          Returns void

    Returns this

  • Parameters

    • Optionaloptions: SignalOption

    Returns Readable

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

    Parameters

    Returns void

    v0.9.4

  • Type Parameters

    • T extends ReadableStream

    Parameters

    • stream:
          | ComposeFnParam
          | T
          | Iterable<T>
          | AsyncIterable<T>
    • Optionaloptions: {
          signal: AbortSignal;
      }
      • signal: AbortSignal

    Returns T

  • Returns void

  • Parameters

    • Optionalerror: Error

    Returns this

  • Parameters

    • limit: number
    • Optionaloptions: SignalOption

    Returns Readable

  • Parameters

    • event: "close"

    Returns boolean

  • Parameters

    • event: "drain"

    Returns boolean

  • Parameters

    • event: "error"
    • err: Error

    Returns boolean

  • Parameters

    • event: "finish"

    Returns boolean

  • Parameters

    • event: "pipe"
    • src: Readable

    Returns boolean

  • Parameters

    • event: "unpipe"
    • src: Readable

    Returns boolean

  • Parameters

    • event: string | symbol
    • Rest...args: any[]

    Returns boolean

  • Parameters

    • Optionalcb: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • chunk: any
    • Optionalcb: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • chunk: any
    • Optionalencoding: string
    • Optionalcb: (() => void)
        • (): void
        • Returns void

    Returns this

  • Returns (string | symbol)[]

  • Parameters

    • fn: ((data: any, options?: SignalOption) => boolean | Promise<boolean>)
        • (data, options?): boolean | Promise<boolean>
        • Parameters

          • data: any
          • Optionaloptions: SignalOption

          Returns boolean | Promise<boolean>

    • Optionaloptions: ArrayOptions

    Returns Promise<boolean>

  • Parameters

    • fn: ((data: any, options?: SignalOption) => boolean | Promise<boolean>)
        • (data, options?): boolean | Promise<boolean>
        • Parameters

          • data: any
          • Optionaloptions: SignalOption

          Returns boolean | Promise<boolean>

    • Optionaloptions: ArrayOptions

    Returns Readable

  • Type Parameters

    • T

    Parameters

    • fn: ((data: any, options?: SignalOption) => data is T)
        • (data, options?): data is T
        • Parameters

          • data: any
          • Optionaloptions: SignalOption

          Returns data is T

    • Optionaloptions: ArrayOptions

    Returns Promise<undefined | T>

  • Parameters

    • fn: ((data: any, options?: SignalOption) => boolean | Promise<boolean>)
        • (data, options?): boolean | Promise<boolean>
        • Parameters

          • data: any
          • Optionaloptions: SignalOption

          Returns boolean | Promise<boolean>

    • Optionaloptions: ArrayOptions

    Returns Promise<any>

  • Parameters

    • fn: ((data: any, options?: SignalOption) => any)
        • (data, options?): any
        • Parameters

          • data: any
          • Optionaloptions: SignalOption

          Returns any

    • Optionaloptions: ArrayOptions

    Returns Readable

  • Parameters

    • fn: ((data: any, options?: SignalOption) => void | Promise<void>)
        • (data, options?): void | Promise<void>
        • Parameters

          • data: any
          • Optionaloptions: SignalOption

          Returns void | Promise<void>

    • Optionaloptions: ArrayOptions

    Returns Promise<void>

  • Returns number

  • Returns boolean

  • Parameters

    • Optionaloptions: {
          destroyOnReturn?: boolean;
      }
      • OptionaldestroyOnReturn?: boolean

    Returns AsyncIterableIterator<any>

  • Parameters

    • eventName: string | symbol

    Returns number

  • Parameters

    • eventName: string | symbol

    Returns Function[]

  • Parameters

    • fn: ((data: any, options?: SignalOption) => any)
        • (data, options?): any
        • Parameters

          • data: any
          • Optionaloptions: SignalOption

          Returns any

    • Optionaloptions: ArrayOptions

    Returns Readable

  • Parameters

    • eventName: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args): void
        • Parameters

          • Rest...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: ((err: Error) => void)
        • (err): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: ((src: Readable) => void)
        • (src): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: ((src: Readable) => void)
        • (src): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args): void
        • Parameters

          • Rest...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: ((err: Error) => void)
        • (err): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: ((src: Readable) => void)
        • (src): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: ((src: Readable) => void)
        • (src): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args): void
        • Parameters

          • Rest...args: any[]

          Returns void

    Returns this

  • Returns this

  • Type Parameters

    • T extends _IWritable

    Parameters

    • destination: T
    • Optionaloptions: {
          end?: boolean;
      }
      • Optionalend?: boolean

    Returns T

  • Parameters

    • event: "close"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: ((err: Error) => void)
        • (err): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: ((src: Readable) => void)
        • (src): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: ((src: Readable) => void)
        • (src): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args): void
        • Parameters

          • Rest...args: any[]

          Returns void

    Returns this

  • Parameters

    • event: "close"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: ((err: Error) => void)
        • (err): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: ((src: Readable) => void)
        • (src): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: ((src: Readable) => void)
        • (src): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args): void
        • Parameters

          • Rest...args: any[]

          Returns void

    Returns this

  • Parameters

    • chunk: any
    • Optionalencoding: string

    Returns boolean

  • Parameters

    • eventName: string | symbol

    Returns Function[]

  • Parameters

    • Optionalsize: number

    Returns any

  • Type Parameters

    • T = any

    Parameters

    • fn: ((previous: any, data: any, options?: Pick<ArrayOptions, "signal">) => T)
        • (previous, data, options?): T
        • Parameters

          • previous: any
          • data: any
          • Optionaloptions: Pick<ArrayOptions, "signal">

          Returns T

    • Optionalinitial: undefined
    • Optionaloptions: Pick<ArrayOptions, "signal">

    Returns Promise<T>

  • Type Parameters

    • T = any

    Parameters

    • fn: ((previous: T, data: any, options?: Pick<ArrayOptions, "signal">) => T)
        • (previous, data, options?): T
        • Parameters

          • previous: T
          • data: any
          • Optionaloptions: Pick<ArrayOptions, "signal">

          Returns T

    • initial: T
    • Optionaloptions: Pick<ArrayOptions, "signal">

    Returns Promise<T>

  • Parameters

    • Optionalevent: string | symbol

    Returns this

  • Parameters

    • event: "close"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: ((err: Error) => void)
        • (err): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: (() => void)
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: ((src: Readable) => void)
        • (src): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: ((src: Readable) => void)
        • (src): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args): void
        • Parameters

          • Rest...args: any[]

          Returns void

    Returns this

  • Returns this

  • Parameters

    • encoding: string

    Returns this

  • Parameters

    • encoding: string

    Returns this

  • Parameters

    • n: number

    Returns this

  • Parameters

    • fn: ((data: any, options?: SignalOption) => boolean | Promise<boolean>)
        • (data, options?): boolean | Promise<boolean>
        • Parameters

          • data: any
          • Optionaloptions: SignalOption

          Returns boolean | Promise<boolean>

    • Optionaloptions: ArrayOptions

    Returns Promise<boolean>

  • Parameters

    • limit: number
    • Optionaloptions: SignalOption

    Returns Readable

  • Parameters

    • Optionaloptions: SignalOption

    Returns Promise<any[]>

  • Returns void

  • Parameters

    • Optionaldestination: Writable

    Returns this

  • Parameters

    • chunk: any

    Returns void

  • Parameters

    • oldStream: Readable

    Returns this

  • Parameters

    • chunk: any
    • Optionalcb: ((error: undefined | null | Error) => void)
        • (error): void
        • Parameters

          • error: undefined | null | Error

          Returns void

    Returns boolean

  • Parameters

    • chunk: any
    • Optionalencoding: string
    • Optionalcb: ((error: undefined | null | Error) => void)
        • (error): void
        • Parameters

          • error: undefined | null | Error

          Returns void

    Returns boolean