Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GridFSBucketReadStream

A readable stream that enables you to read buffers from GridFS.

Do not instantiate this class directly. Use openDownloadStream() instead.

Hierarchy

  • Readable
    • GridFSBucketReadStream

Index

Constructors

constructor

Events

Static Readonly CLOSE

CLOSE: "close" = ...

Fired when the stream is exhausted and the underlying cursor is killed

Static Readonly DATA

DATA: "data" = ...

Emitted when a chunk of data is available to be consumed.

Static Readonly END

END: "end" = ...

Fired when the stream is exhausted (no more data events).

Static Readonly ERROR

ERROR: "error" = ...

An error occurred

Static Readonly FILE

FILE: "file" = ...

Fires when the stream loaded the file document corresponding to the provided id.

Properties

destroyed

destroyed: boolean

readable

readable: boolean

Readonly readableEncoding

readableEncoding: null | BufferEncoding

Readonly readableEnded

readableEnded: boolean

Readonly readableFlowing

readableFlowing: null | boolean

Readonly readableHighWaterMark

readableHighWaterMark: number

Readonly readableLength

readableLength: number

Readonly readableObjectMode

readableObjectMode: boolean

s

internal

Static Readonly captureRejectionSymbol

captureRejectionSymbol: typeof captureRejectionSymbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly errorMonitor

errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Methods

[asyncIterator]

  • [asyncIterator](): AsyncIterableIterator<any>
  • Returns AsyncIterableIterator<any>

Optional _construct

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

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

          • Optional error: null | Error

          Returns void

    Returns void

_destroy

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

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

          • Optional error: null | Error

          Returns void

    Returns void

_read

  • _read(): void
  • Reads from the cursor and pushes to the stream. Private Impl, do not call directly

    internal

    Returns void

abort

  • abort(callback?: Callback<void>): void
  • Marks this stream as aborted (will never push another data event) and kills the underlying cursor. Will emit the 'end' event, and then the 'close' event once the cursor is successfully killed.

    Parameters

    • Optional callback: Callback<void>

      called when the cursor is successfully closed or an error occurred.

    Returns void

addListener

  • Event emitter The defined events on documents including:

    1. close
    2. data
    3. end
    4. error
    5. pause
    6. readable
    7. resume

    Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • chunk: any

          Returns void

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • err: Error

          Returns void

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns GridFSBucketReadStream

destroy

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

    • Optional error: Error

    Returns void

emit

  • emit(event: "close"): boolean
  • emit(event: "data", chunk: any): boolean
  • emit(event: "end"): boolean
  • emit(event: "error", err: Error): boolean
  • emit(event: "pause"): boolean
  • emit(event: "readable"): boolean
  • emit(event: "resume"): boolean
  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: "close"

    Returns boolean

  • Parameters

    • event: "data"
    • chunk: any

    Returns boolean

  • Parameters

    • event: "end"

    Returns boolean

  • Parameters

    • event: "error"
    • err: Error

    Returns boolean

  • Parameters

    • event: "pause"

    Returns boolean

  • Parameters

    • event: "readable"

    Returns boolean

  • Parameters

    • event: "resume"

    Returns boolean

  • Parameters

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

    Returns boolean

end

  • Sets the 0-based offset in bytes to start streaming from. Throws an error if this stream has entered flowing mode (e.g. if you've already called on('data'))

    Parameters

    • end: number = 0

      Offset in bytes to stop reading at

    Returns GridFSBucketReadStream

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

getMaxListeners

  • getMaxListeners(): number
  • Returns number

isPaused

  • isPaused(): boolean
  • Returns boolean

listenerCount

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

    • event: string | symbol

    Returns number

listeners

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

    • event: string | symbol

    Returns Function[]

off

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns GridFSBucketReadStream

on

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • chunk: any

          Returns void

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • err: Error

          Returns void

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns GridFSBucketReadStream

once

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • chunk: any

          Returns void

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • err: Error

          Returns void

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns GridFSBucketReadStream

pause

  • Returns GridFSBucketReadStream

pipe

  • pipe<T>(destination: T, options?: { end?: boolean }): T
  • Type parameters

    • T: WritableStream<T>

    Parameters

    • destination: T
    • Optional options: { end?: boolean }
      • Optional end?: boolean

    Returns T

prependListener

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • chunk: any

          Returns void

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • err: Error

          Returns void

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns GridFSBucketReadStream

prependOnceListener

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • chunk: any

          Returns void

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • err: Error

          Returns void

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns GridFSBucketReadStream

push

  • push(chunk: any, encoding?: BufferEncoding): boolean
  • Parameters

    • chunk: any
    • Optional encoding: BufferEncoding

    Returns boolean

rawListeners

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

    • event: string | symbol

    Returns Function[]

read

  • read(size?: number): any
  • Parameters

    • Optional size: number

    Returns any

removeAllListeners

  • Parameters

    • Optional event: string | symbol

    Returns GridFSBucketReadStream

removeListener

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • chunk: any

          Returns void

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • err: Error

          Returns void

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

    Returns GridFSBucketReadStream

  • Parameters

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

          • Rest ...args: any[]

          Returns void

    Returns GridFSBucketReadStream

resume

  • Returns GridFSBucketReadStream

setEncoding

  • Parameters

    • encoding: BufferEncoding

    Returns GridFSBucketReadStream

setMaxListeners

  • Parameters

    • n: number

    Returns GridFSBucketReadStream

start

  • Sets the 0-based offset in bytes to start streaming from. Throws an error if this stream has entered flowing mode (e.g. if you've already called on('data'))

    Parameters

    • start: number = 0

      0-based offset in bytes to start streaming from

    Returns GridFSBucketReadStream

unpipe

  • Parameters

    • Optional destination: WritableStream

    Returns GridFSBucketReadStream

unshift

  • unshift(chunk: any, encoding?: BufferEncoding): void
  • Parameters

    • chunk: any
    • Optional encoding: BufferEncoding

    Returns void

wrap

  • Parameters

    • oldStream: ReadableStream

    Returns GridFSBucketReadStream

Static from

  • from(iterable: Iterable<any> | AsyncIterable<any>, options?: ReadableOptions): Readable
  • A utility method for creating Readable Streams out of iterators.

    Parameters

    • iterable: Iterable<any> | AsyncIterable<any>
    • Optional options: ReadableOptions

    Returns Readable

Static getEventListener

  • getEventListener(emitter: DOMEventTarget | EventEmitter, name: string | symbol): Function[]
  • Returns a list listener for a specific emitter event name.

    Parameters

    • emitter: DOMEventTarget | EventEmitter
    • name: string | symbol

    Returns Function[]

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static on

  • on(emitter: EventEmitter, event: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>
  • Parameters

    • emitter: EventEmitter
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns AsyncIterableIterator<any>

Static once

  • once(emitter: NodeEventTarget, event: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>
  • once(emitter: DOMEventTarget, event: string, options?: StaticEventEmitterOptions): Promise<any[]>
  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

Generated using TypeDoc