@office-open/docx 0.10.14 → 0.11.0

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 CHANGED
@@ -4,7 +4,7 @@
4
4
  ![npm downloads](https://img.shields.io/npm/dw/@office-open/docx)
5
5
  ![npm license](https://img.shields.io/npm/l/@office-open/docx)
6
6
 
7
- > Generate, parse, and patch .docx documents with a declarative TypeScript API. Works in Node.js and browsers.
7
+ > Create Word documents (.docx) in TypeScript and JavaScript — generate, parse, and patch from plain JSON, no Microsoft Office required. Built for AI agents and hand-written code alike; runs in Node.js, browsers, Deno, and Bun.
8
8
 
9
9
  ## Features
10
10
 
@@ -86,32 +86,36 @@ Performance vs original `docx` (9.6.1) package (higher ops/s is better, Windows
86
86
  await generateDocument(options);
87
87
  // All STORE (no compression)
88
88
  await generateDocument(options, { compression: { xml: 0, media: 0 } });
89
+ // Stream as ReadableStream<Uint8Array> (pipe to a file / HTTP response)
90
+ generateDocumentStream(options);
89
91
  ```
90
92
 
91
- **Create + toBuffer (end-to-end)**
93
+ **Create + toBuffer / toStream (end-to-end)**
92
94
 
93
- | Scenario | Default sync | Default async | All STORE sync | All STORE async | docx |
94
- | ------------------------------ | -----------: | ------------: | -------------: | --------------: | ---------: |
95
- | Simple (2p + 1 img) | 915 ops/s | 584 ops/s | 2,454 ops/s | 2,545 ops/s | 86.3 ops/s |
96
- | Styled paragraphs (20) + 1 img | 935 ops/s | 626 ops/s | 2,721 ops/s | 2,522 ops/s | 90.1 ops/s |
97
- | Table (10x5) | 1,164 ops/s | 659 ops/s | 2,743 ops/s | 2,821 ops/s | 227 ops/s |
98
- | Full featured + 2 imgs | 753 ops/s | 527 ops/s | 1,601 ops/s | 1,615 ops/s | 56.6 ops/s |
95
+ | Scenario | Default sync | Default async | All STORE sync | All STORE async | Default stream | docx |
96
+ | ------------------------------ | -----------: | ------------: | -------------: | --------------: | -------------: | ---------: |
97
+ | Simple (2p + 1 img) | 868 ops/s | 562 ops/s | 2,334 ops/s | 2,312 ops/s | 13.9 ops/s | 71.4 ops/s |
98
+ | Styled paragraphs (20) + 1 img | 944 ops/s | 567 ops/s | 2,720 ops/s | 2,494 ops/s | 13.0 ops/s | 84.1 ops/s |
99
+ | Table (10x5) | 1,081 ops/s | 590 ops/s | 2,583 ops/s | 2,774 ops/s | 12.9 ops/s | 205 ops/s |
100
+ | Full featured + 2 imgs | 777 ops/s | 488 ops/s | 1,433 ops/s | 1,645 ops/s | 11.1 ops/s | 49.7 ops/s |
99
101
 
100
- **Large Files — Create + toBuffer**
102
+ **Large Files — Create + toBuffer / toStream**
101
103
 
102
- | Scenario | Default sync | Default async | All STORE sync | All STORE async | docx |
103
- | ------------------------------ | -----------: | ------------: | -------------: | --------------: | ---------: |
104
- | 2000 paragraphs + 20 images | 85.4 ops/s | 77.1 ops/s | 90.5 ops/s | 86.4 ops/s | 2.95 ops/s |
105
- | 200x10 table | 194 ops/s | 175 ops/s | 220 ops/s | 222 ops/s | 33.9 ops/s |
106
- | 20 sections x 100p + 40 images | 80.5 ops/s | 66.2 ops/s | 89.7 ops/s | 91.7 ops/s | 1.80 ops/s |
104
+ | Scenario | Default sync | Default async | All STORE sync | All STORE async | Default stream | docx |
105
+ | ------------------------------ | -----------: | ------------: | -------------: | --------------: | -------------: | ---------: |
106
+ | 2000 paragraphs + 20 images | 107.9 ops/s | 83.9 ops/s | 112.9 ops/s | 105.3 ops/s | 8.52 ops/s | 2.66 ops/s |
107
+ | 200x10 table | 215.8 ops/s | 173.7 ops/s | 215.2 ops/s | 218.4 ops/s | 6.30 ops/s | 33.2 ops/s |
108
+ | 20 sections x 100p + 40 images | 83.8 ops/s | 67.4 ops/s | 103.4 ops/s | 103.8 ops/s | 3.14 ops/s | 1.67 ops/s |
107
109
 
108
110
  **Large File (~100MB) — Mixed Content**
109
111
 
110
112
  500 styled paragraphs + 38 mixed-size images (1-5MB, 100MB total) + 50x10 table.
111
113
 
112
- | Scenario | Default sync | Default async | All STORE sync | All STORE async | docx |
113
- | ------------------------ | -----------: | ------------: | -------------: | --------------: | ---------: |
114
- | Mixed (500p+38img+50x10) | 23.7 ops/s | 21.8 ops/s | 23.4 ops/s | 24.5 ops/s | 0.30 ops/s |
114
+ | Scenario | Default sync | Default async | All STORE sync | All STORE async | Default stream | docx |
115
+ | ------------------------ | -----------: | ------------: | -------------: | --------------: | -------------: | ---------: |
116
+ | Mixed (500p+38img+50x10) | 23.9 ops/s | 22.9 ops/s | 24.2 ops/s | 24.6 ops/s | 3.59 ops/s | 0.29 ops/s |
117
+
118
+ **Stream column** = `generateDocumentStream` (default compression, fully drained). Streaming trades throughput for pipeability: each part is compressed in a Web Worker as it is produced, so a fixed per-part worker handoff dominates small documents — streaming targets memory footprint and piping (file / HTTP response), not peak ops/s.
115
119
 
116
120
  ## License
117
121