Class: TempFileSink
sempdf / 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
new TempFileSink(): TempFileSink;Returns
TempFileSink
Accessors
path
Get Signature
get path(): string | null;Defined in: src/internal/byte-sink.ts:230
Returns the underlying file path once writing has started.
Returns
string | null
Methods
close()
close(): Promise<void>;Defined in: src/internal/byte-sink.ts:260
Closes the write stream and deletes the temporary file.
Returns
Promise<void>
Implementation of
dispose()
dispose(): Promise<void>;Defined in: src/internal/byte-sink.ts:302
Deletes the temp file without closing the sink cleanly.
Returns
Promise<void>
getBytes()
getBytes(): Promise<Uint8Array<ArrayBufferLike>>;Defined in: src/internal/byte-sink.ts:287
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()
write(chunk): Promise<void>;Defined in: src/internal/byte-sink.ts:234
Writes a generated PDF byte chunk to the sink.
Parameters
| Parameter | Type |
|---|---|
chunk | Uint8Array |
Returns
Promise<void>