Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BufferingStream<T>

This component will buffer whatever is pushed to it and emit chunks back every BufferingStreamOptions.emitInterval. It will also ensure that the emitted chunks never exceed BufferingStreamOptions.maxChunkSize.

Type Parameters

  • T

Hierarchy

Index

Constructors

  • new BufferingStream<T>(options?: BufferingStreamOptions, concat: ((left: T, right: T) => T), slice: ((what: T, start?: number, end?: number) => T), length: ((what: T) => number)): BufferingStream<T>
  • Type Parameters

    • T

    Parameters

    • options: BufferingStreamOptions = {}
    • concat: ((left: T, right: T) => T)
        • (left: T, right: T): T
        • Parameters

          • left: T
          • right: T

          Returns T

    • slice: ((what: T, start?: number, end?: number) => T)
        • (what: T, start?: number, end?: number): T
        • Parameters

          • what: T
          • Optional start: number
          • Optional end: number

          Returns T

    • length: ((what: T) => number)
        • (what: T): number
        • Parameters

          • what: T

          Returns number

    Returns BufferingStream<T>

Properties

buffer?: T
concat: ((left: T, right: T) => T)

Type declaration

    • (left: T, right: T): T
    • Parameters

      • left: T
      • right: T

      Returns T

emitInterval: number
length: ((what: T) => number)

Type declaration

    • (what: T): number
    • Parameters

      • what: T

      Returns number

maxChunkSize: number
onDataEmitter: Emitter<T> = ...
slice: ((what: T, start?: number, end?: number) => T)

Type declaration

    • (what: T, start?: number, end?: number): T
    • Parameters

      • what: T
      • Optional start: number
      • Optional end: number

      Returns T

timeout?: Timeout

Accessors

  • get onData(): Event<T>

Methods

  • dispose(): void
  • emitBufferedChunk(): void
  • push(chunk: T): void