Appearance
zeropdf / TempFileSink
Class: TempFileSink
Defined in: src/internal/byte-sink.ts:222
A byte sink that writes data to a temporary file, reducing memory pressure for very large documents. The temp file is automatically deleted on close (or dispose).
Implements
Constructors
Constructor
ts
new TempFileSink(): TempFileSink;Defined in: src/internal/byte-sink.ts:230
Creates a TempFileSink backed by a temporary file.
Returns
TempFileSink
Accessors
path
Get Signature
ts
get path(): string | null;Defined in: src/internal/byte-sink.ts:237
Returns the underlying file path once writing has started.
Returns
string | null
Methods
close()
ts
close(): Promise<void>;Defined in: src/internal/byte-sink.ts:267
Closes the write stream and deletes the temporary file.
Returns
Promise<void>
Implementation of
dispose()
ts
dispose(): Promise<void>;Defined in: src/internal/byte-sink.ts:309
Deletes the temp file without closing the sink cleanly.
Returns
Promise<void>
getBytes()
ts
getBytes(): Promise<Uint8Array<ArrayBufferLike>>;Defined in: src/internal/byte-sink.ts:294
Reads the temp file contents back into memory. The file must still be open (i.e. close must not have been called yet).
Returns
Promise<Uint8Array<ArrayBufferLike>>
The full temp file contents as a Uint8Array.
write()
ts
write(chunk): Promise<void>;Defined in: src/internal/byte-sink.ts:241
Writes a generated PDF byte chunk to the sink.
Parameters
| Parameter | Type |
|---|---|
chunk | Uint8Array |
Returns
Promise<void>