Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MockWritable

Hierarchy

  • Writable
    • MockWritable

Implements

  • WritableStream

Index

Constructors

constructor

Properties

Private _data

_data: any[] = []

destroyed

destroyed: boolean

Readonly writable

writable: boolean

Readonly writableCorked

writableCorked: number

Readonly writableEnded

writableEnded: boolean

Readonly writableFinished

writableFinished: boolean

Readonly writableHighWaterMark

writableHighWaterMark: number

Readonly writableLength

writableLength: number

Readonly writableObjectMode

writableObjectMode: boolean

Methods

_destroy

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

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

          • Optional error: Error | null

          Returns void

    Returns void

_final

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

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

          • Optional error: Error | null

          Returns void

    Returns void

_write

  • _write(data: Buffer | string, encoding: string, callback: Function): void

Optional _writev

  • _writev(chunks: Array<{ chunk: any; encoding: string }>, callback: (error?: Error | null) => void): void
  • Parameters

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

          • Optional error: Error | null

          Returns void

    Returns void

addListener

  • addListener(event: "close", listener: () => void): this
  • addListener(event: "drain", listener: () => void): this
  • addListener(event: "error", listener: (err: Error) => void): this
  • addListener(event: "finish", listener: () => void): this
  • addListener(event: "pipe", listener: (src: Readable) => void): this
  • addListener(event: "unpipe", listener: (src: Readable) => void): this
  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • 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

  • Parameters

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

    Returns this

  • Parameters

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

          Returns void

    Returns this

  • Parameters

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

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

cork

  • cork(): void
  • Returns void

data

  • data(): any[]

destroy

  • destroy(error?: Error): void
  • Parameters

    Returns void

emit

  • emit(event: "close"): boolean
  • emit(event: "drain"): boolean
  • emit(event: "error", err: Error): boolean
  • emit(event: "finish"): boolean
  • emit(event: "pipe", src: Readable): boolean
  • emit(event: "unpipe", src: Readable): boolean
  • emit(event: string | symbol, ...args: any[]): boolean
  • 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

end

  • end(): void

eventNames

  • eventNames(): Array<string | symbol>

getMaxListeners

  • getMaxListeners(): number

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

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

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

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • 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: "pipe", listener: (src: Readable) => void): this
  • on(event: "unpipe", listener: (src: Readable) => void): this
  • on(event: string | symbol, listener: (...args: any[]) => void): 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
        • Parameters

          Returns void

    Returns this

  • Parameters

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

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • 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: "pipe", listener: (src: Readable) => void): this
  • once(event: "unpipe", listener: (src: Readable) => void): this
  • once(event: string | symbol, listener: (...args: any[]) => void): 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
        • Parameters

          Returns void

    Returns this

  • Parameters

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

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

pipe

  • pipe<T>(destination: T, options?: undefined | { end?: undefined | false | true }): T
  • Type parameters

    • T: WritableStream

    Parameters

    • destination: T
    • Optional options: undefined | { end?: undefined | false | true }

    Returns T

prependListener

  • 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: "pipe", listener: (src: Readable) => void): this
  • prependListener(event: "unpipe", listener: (src: Readable) => void): this
  • prependListener(event: string | symbol, listener: (...args: any[]) => void): 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
        • Parameters

          Returns void

    Returns this

  • Parameters

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

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • 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: "pipe", listener: (src: Readable) => void): this
  • prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this
  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): 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
        • Parameters

          Returns void

    Returns this

  • Parameters

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

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: "close", listener: () => void): this
  • removeListener(event: "drain", listener: () => void): this
  • removeListener(event: "error", listener: (err: Error) => void): this
  • removeListener(event: "finish", listener: () => void): this
  • removeListener(event: "pipe", listener: (src: Readable) => void): this
  • removeListener(event: "unpipe", listener: (src: Readable) => void): this
  • removeListener(event: string | symbol, listener: (...args: any[]) => void): 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
        • Parameters

          Returns void

    Returns this

  • Parameters

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

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • src: Readable

          Returns void

    Returns this

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns this

setDefaultEncoding

  • setDefaultEncoding(encoding: string): this

setMaxListeners

  • setMaxListeners(n: number): this

uncork

  • uncork(): void
  • Returns void

write

  • write(data: Buffer | string): boolean

Generated using TypeDoc