Class ReadStream

Hierarchy

  • Readable
    • ReadStream

Implements

  • ReadStream

Constructors

  • Parameters

    • Optionaloptions: ReadableOptions

    Returns ReadStream

Properties

_readableState: ReadableState
[asyncDispose]: never
bytesRead: number

The number of bytes that have been read so far.

v6.4.0

closed: boolean
destroyed: boolean
errored: null | Error
path: string | Buffer

The path to the file the stream is reading from as specified in the first argument to fs.createReadStream(). If path is passed as a string, thenreadStream.path will be a string. If path is passed as a Buffer, thenreadStream.path will be a Buffer. If fd is specified, thenreadStream.path will be undefined.

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, v10.16.0

readable: boolean
readableAborted: never
readableDidRead: never
readableEncoding: never
readableEnded: never
readableFlowing: null | boolean
readableHighWaterMark: number
readableLength: number
readableObjectMode: never

Methods

  • Parameters

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

          • Optionalerror: null | Error

          Returns void

    Returns void

  • Parameters

    • size: number

    Returns void

  • Returns void

  • Returns AsyncIterableIterator<any>

  • Event emitter The defined events on documents including:

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

    Parameters

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

    Returns this

  • Parameters

    • event: "data"
    • listener: ((chunk: any) => void)
        • (chunk): void
        • Parameters

          • chunk: any

          Returns void

    Returns this

  • Parameters

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

    Returns this

  • Parameters

    • event: "readable"
    • 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: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args): void
        • Parameters

          • Rest...args: any[]

          Returns void

    Returns this

  • Parameters

    • Optionaloptions: SignalOption

    Returns Readable

  • Type Parameters

    • T extends ReadableStream

    Parameters

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

    Returns T

  • Parameters

    • Optionalerror: Error

    Returns this

  • Parameters

    • limit: number
    • Optionaloptions: SignalOption

    Returns Readable

  • Parameters

    • event: "close"

    Returns boolean

  • Parameters

    • event: "data"
    • chunk: any

    Returns boolean

  • Parameters

    • event: "end"

    Returns boolean

  • Parameters

    • event: "readable"

    Returns boolean

  • Parameters

    • event: "error"
    • err: Error

    Returns boolean

  • Parameters

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

    Returns boolean

  • 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: "data"
    • listener: ((chunk: any) => void)
        • (chunk): void
        • Parameters

          • chunk: any

          Returns void

    Returns this

  • Parameters

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

    Returns this

  • Parameters

    • event: "readable"
    • 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: 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: "data"
    • listener: ((chunk: any) => void)
        • (chunk): void
        • Parameters

          • chunk: any

          Returns void

    Returns this

  • Parameters

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

    Returns this

  • Parameters

    • event: "readable"
    • 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: 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: "data"
    • listener: ((chunk: any) => void)
        • (chunk): void
        • Parameters

          • chunk: any

          Returns void

    Returns this

  • Parameters

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

    Returns this

  • Parameters

    • event: "readable"
    • 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: 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: "data"
    • listener: ((chunk: any) => void)
        • (chunk): void
        • Parameters

          • chunk: any

          Returns void

    Returns this

  • Parameters

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

    Returns this

  • Parameters

    • event: "readable"
    • 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: 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: "data"
    • listener: ((chunk: any) => void)
        • (chunk): void
        • Parameters

          • chunk: any

          Returns void

    Returns this

  • Parameters

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

    Returns this

  • Parameters

    • event: "readable"
    • 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: string | symbol
    • listener: ((...args: any[]) => void)
        • (...args): void
        • Parameters

          • Rest...args: any[]

          Returns void

    Returns this

  • 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[]>

  • Parameters

    • Optionaldestination: Writable

    Returns this

  • Parameters

    • chunk: any

    Returns void

  • Parameters

    • oldStream: Readable

    Returns this