Bun

class

ArrayBufferSink

class ArrayBufferSink

Fast incremental writer that becomes an ArrayBuffer on end().

  • end(): ArrayBuffer | Uint8Array<ArrayBufferLike>;
  • flush(): number | ArrayBuffer | Uint8Array<ArrayBufferLike>;

    Flush the internal buffer

    If ArrayBufferSink.start was passed a stream option, this will return a ArrayBuffer If ArrayBufferSink.start was passed a stream option and asUint8Array, this will return a Uint8Array Otherwise, this will return the number of bytes written since the last flush

    This API might change later to separate Uint8ArraySink and ArrayBufferSink

  • options?: { asUint8Array: boolean; highWaterMark: number; stream: boolean }
    ): void;
  • chunk: string | ArrayBuffer | SharedArrayBuffer | ArrayBufferView<ArrayBufferLike>
    ): number;