@reportwright/pdf 0.1.0-beta.5 → 0.1.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/THIRD-PARTY-NOTICES.md +1 -1
- package/dist/fflate.js +2341 -0
- package/dist/index.js +1616 -2010
- package/fflate.d.ts +3 -0
- package/index.d.ts +15 -2
- package/package.json +3 -2
package/fflate.d.ts
ADDED
package/index.d.ts
CHANGED
|
@@ -64,6 +64,13 @@ export interface PdfOptions {
|
|
|
64
64
|
creationDate?: Date;
|
|
65
65
|
/** Flate-compress content, fonts, object streams (default true). */
|
|
66
66
|
compress?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The zlib level (0–9) the object streams (the small objects, packed together) and the cross-reference stream are
|
|
69
|
+
* compressed at. Unset: the object streams at 6 and the cross-reference stream by the bundled fflate at 6, as before
|
|
70
|
+
* beta.7. Set, both go through the platform's zlib (Node's) at that level: 9 makes the file a little smaller and
|
|
71
|
+
* slower. The same input and options give the same bytes.
|
|
72
|
+
*/
|
|
73
|
+
objectStreamLevel?: number;
|
|
67
74
|
/**
|
|
68
75
|
* PDF/A: an output intent (sRGB, or outputIntent: your RGB or CMYK ICC output/monitor profile) and XMP
|
|
69
76
|
* identification. Fonts must be embedded; device colour must match the intent (CMYK needs a CMYK intent, RGB an RGB one).
|
|
@@ -858,9 +865,10 @@ export interface BulkTaskTypes {
|
|
|
858
865
|
}
|
|
859
866
|
export type BulkResult<V> = { ok: true; value: V } | { ok: false; error: { name: string; code?: string; message: string } };
|
|
860
867
|
export interface BulkOptions {
|
|
861
|
-
/** worker threads; default os.availableParallelism() - 1 (at least 1). 1, or no node:worker_threads (browsers): one at a time, in this thread
|
|
868
|
+
/** worker threads (1 to 64); default os.availableParallelism() - 1 (at least 1). 1, or no node:worker_threads (browsers): one at a time, in this thread.
|
|
869
|
+
* Workers are kept warm (unref'd) for 2 s after a call, for the next; small files are sent several at a time */
|
|
862
870
|
workers?: number;
|
|
863
|
-
/** each worker's heap cap in MB (resourceLimits.maxOldGenerationSizeMb), default 512: an item past it fails with E_WORKER, alone */
|
|
871
|
+
/** each worker's heap cap in MB (resourceLimits.maxOldGenerationSizeMb), 16 to 16384, default 512: an item past it fails with E_WORKER, alone */
|
|
864
872
|
memoryMb?: number;
|
|
865
873
|
/** loadPdf's options, for every input */
|
|
866
874
|
password?: string;
|
|
@@ -872,6 +880,11 @@ export interface BulkOptions {
|
|
|
872
880
|
save?: SaveOptions;
|
|
873
881
|
/** each item's result as it finishes (index in inputs) */
|
|
874
882
|
onResult?: (index: number, result: BulkResult<unknown>) => void;
|
|
883
|
+
/** each item's time limit in a worker, default 120000, at most 2147483647: past it the worker is ended, the item fails with E_TIMEOUT and the rest go on.
|
|
884
|
+
* With one input, workers: 1, or a host where workers resolve to 1 (2 CPUs), items run in the calling thread: no time limit and no heap cap apply there. */
|
|
885
|
+
itemTimeoutMs?: number;
|
|
886
|
+
/** stops the call: its workers are ended (not kept warm) and bulk rejects with the signal's reason (AbortSignal.timeout(ms) for a time limit) */
|
|
887
|
+
signal?: AbortSignal;
|
|
875
888
|
}
|
|
876
889
|
/** One named task over many inputs, in parallel worker threads (Node); results in input order, a failing item never stops the rest. */
|
|
877
890
|
export function bulk<T extends BulkTask>(inputs: Iterable<BulkTaskTypes[T]['input']>, task: T, options?: BulkOptions): Promise<BulkResult<BulkTaskTypes[T]['value']>[]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reportwright/pdf",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.9",
|
|
4
4
|
"description": "A streaming PDF writer for Node and browsers with no runtime dependencies: flat memory, PDF/A-1b to 3a, PDF/UA-1, Factur-X, embedded TrueType with Unicode text.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -12,11 +12,12 @@
|
|
|
12
12
|
"publishConfig": { "access": "public" },
|
|
13
13
|
"exports": {
|
|
14
14
|
".": { "types": "./index.d.ts", "default": "./dist/index.js" },
|
|
15
|
+
"./fflate": { "types": "./fflate.d.ts", "default": "./dist/fflate.js" },
|
|
15
16
|
"./examples/*": "./examples/*",
|
|
16
17
|
"./package.json": "./package.json"
|
|
17
18
|
},
|
|
18
19
|
"types": "./index.d.ts",
|
|
19
|
-
"files": ["dist", "index.d.ts", "examples", "README.md", "LICENSE", "THIRD-PARTY-NOTICES.md"],
|
|
20
|
+
"files": ["dist", "index.d.ts", "fflate.d.ts", "examples", "README.md", "LICENSE", "THIRD-PARTY-NOTICES.md"],
|
|
20
21
|
"engines": { "node": ">=20.16" },
|
|
21
22
|
"sideEffects": false
|
|
22
23
|
}
|