Skip to content

zeropdf v1.3.0


zeropdf / BufferSink

Class: BufferSink

Defined in: src/internal/byte-sink.ts:40

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

Implements

Constructors

Constructor

ts
new BufferSink(options?): BufferSink;

Defined in: src/internal/byte-sink.ts:57

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

Parameters

ParameterTypeDescription
optionsBufferSinkOptionsOptions that control the sink behavior.

Returns

BufferSink

Methods

close()

ts
close(): Promise<void>;

Defined in: src/internal/byte-sink.ts:83

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

Returns

Promise<void>

Implementation of

ByteSink.close


collect()

ts
collect(): Uint8Array;

Defined in: src/internal/byte-sink.ts:92

Combines all collected chunks into a single Uint8Array.

Returns

Uint8Array

The collected bytes.


write()

ts
write(chunk): Promise<void>;

Defined in: src/internal/byte-sink.ts:66

Stores a streamed byte chunk in memory.

Parameters

ParameterTypeDescription
chunkUint8ArrayThe byte chunk to write.

Returns

Promise<void>

Implementation of

ByteSink.write

Released under the ISC license.