Skip to main content

Class: BufferSink

Streaming output contract implemented by sinks that receive generated PDF byte chunks.

Implements

Constructors

Constructor

new BufferSink(options?): BufferSink;

Creates a memory-backed byte sink with an optional capacity limit.

Parameters

ParameterTypeDescription
optionsBufferSinkOptionsOptions that control the sink behavior.

Returns

BufferSink

Methods

close()

close(): Promise<void>;

Marks the sink as closed so no more chunks can be written.

Returns

Promise<void>

Implementation of

ByteSink.close


collect()

collect(): Uint8Array;

Combines all collected chunks into a single Uint8Array.

Returns

Uint8Array

The collected bytes.


write()

write(chunk): Promise<void>;

Stores a streamed byte chunk in memory.

Parameters

ParameterTypeDescription
chunkUint8ArrayThe byte chunk to write.

Returns

Promise<void>

Implementation of

ByteSink.write