Class: TempFileSink
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;
Creates a TempFileSink backed by a temporary file.
Returns
TempFileSink
Accessors
path
Get Signature
get path(): string | null;
Returns the underlying file path once writing has started.
Returns
string | null
Methods
close()
close(): Promise<void>;
Closes the write stream and deletes the temporary file.
Returns
Promise<void>
Implementation of
dispose()
dispose(): Promise<void>;
Deletes the temp file without closing the sink cleanly.
Returns
Promise<void>
getBytes()
getBytes(): Promise<Uint8Array<ArrayBufferLike>>;
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>;
Writes a generated PDF byte chunk to the sink.
Parameters
| Parameter | Type |
|---|---|
chunk | Uint8Array |
Returns
Promise<void>