@office-open/docx 0.11.0 → 0.12.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 +26 -18
- package/dist/index.d.mts +1860 -1551
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7905 -5943
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -77,9 +77,9 @@ Check the [demo folder](./demo) for 100+ working examples covering every feature
|
|
|
77
77
|
|
|
78
78
|
## Benchmark
|
|
79
79
|
|
|
80
|
-
Performance vs original `docx` (9.6.1) package (higher ops/s is better, Windows 11
|
|
80
|
+
Performance vs the original `docx` (9.6.1) package (higher ops/s is better, Windows 11; each scenario runs under both Node 24 and Bun 1.4).
|
|
81
81
|
|
|
82
|
-
**Default** = XML DEFLATE level 1
|
|
82
|
+
**Default** = XML DEFLATE level 1; media matches MS Office Word — already-compressed formats (PNG/JPEG/GIF) are STOREd, the rest (EMF/WMF/BMP/TIFF/…) use DEFLATE level 6. **All STORE** = no compression (`{ compression: { xml: 0, media: 0 } }`). The `docx` package (async only) always DEFLATEs every entry including images, with no STORE option.
|
|
83
83
|
|
|
84
84
|
```typescript
|
|
85
85
|
// Default (matches MS Office)
|
|
@@ -90,32 +90,40 @@ await generateDocument(options, { compression: { xml: 0, media: 0 } });
|
|
|
90
90
|
generateDocumentStream(options);
|
|
91
91
|
```
|
|
92
92
|
|
|
93
|
-
**Create + toBuffer / toStream
|
|
93
|
+
**Create + toBuffer / toStream**
|
|
94
94
|
|
|
95
|
-
| Scenario | Default sync | Default async | All STORE sync | All STORE async | Default stream |
|
|
96
|
-
| ------------------------------ |
|
|
97
|
-
| Simple (2p + 1 img) |
|
|
98
|
-
|
|
|
99
|
-
|
|
|
100
|
-
|
|
|
95
|
+
| Scenario | Runtime | Default sync | Default async | All STORE sync | All STORE async | Default stream | docx |
|
|
96
|
+
| ------------------------------ | ------- | ------------ | ------------- | -------------- | --------------- | -------------- | ---------- |
|
|
97
|
+
| Simple (2p + 1 img) | Node 24 | 905 ops/s | 1,311 ops/s | 2,478 ops/s | 2,985 ops/s | 10.1 ops/s | 91.2 ops/s |
|
|
98
|
+
| | Bun 1.4 | 2,471 ops/s | 758 ops/s | 5,323 ops/s | 5,246 ops/s | 384 ops/s | 63.7 ops/s |
|
|
99
|
+
| Styled paragraphs (20) + 1 img | Node 24 | 1,065 ops/s | 1,405 ops/s | 2,765 ops/s | 2,752 ops/s | 14.2 ops/s | 91.1 ops/s |
|
|
100
|
+
| | Bun 1.4 | 2,994 ops/s | 692 ops/s | 4,567 ops/s | 4,627 ops/s | 443 ops/s | 72.2 ops/s |
|
|
101
|
+
| Table (10x5) | Node 24 | 1,301 ops/s | 1,286 ops/s | 3,154 ops/s | 3,163 ops/s | 14.3 ops/s | 196 ops/s |
|
|
102
|
+
| | Bun 1.4 | 2,791 ops/s | 691 ops/s | 5,107 ops/s | 4,882 ops/s | 543 ops/s | 252 ops/s |
|
|
103
|
+
| Full featured + 2 imgs | Node 24 | 763 ops/s | 1,031 ops/s | 1,671 ops/s | 1,576 ops/s | 12.7 ops/s | 54.2 ops/s |
|
|
104
|
+
| | Bun 1.4 | 1,646 ops/s | 575 ops/s | 2,630 ops/s | 2,456 ops/s | 330 ops/s | 41.1 ops/s |
|
|
101
105
|
|
|
102
106
|
**Large Files — Create + toBuffer / toStream**
|
|
103
107
|
|
|
104
|
-
| Scenario | Default sync | Default async | All STORE sync | All STORE async | Default stream |
|
|
105
|
-
| ------------------------------ |
|
|
106
|
-
| 2000 paragraphs + 20 images |
|
|
107
|
-
|
|
|
108
|
-
|
|
|
108
|
+
| Scenario | Runtime | Default sync | Default async | All STORE sync | All STORE async | Default stream | docx |
|
|
109
|
+
| ------------------------------ | ------- | ------------ | ------------- | -------------- | --------------- | -------------- | ---------- |
|
|
110
|
+
| 2000 paragraphs + 20 images | Node 24 | 104.5 ops/s | 109.4 ops/s | 111.6 ops/s | 114.9 ops/s | 11.3 ops/s | 2.85 ops/s |
|
|
111
|
+
| | Bun 1.4 | 148.8 ops/s | 126.5 ops/s | 168.0 ops/s | 164.9 ops/s | 37.4 ops/s | 2.18 ops/s |
|
|
112
|
+
| 200x10 table | Node 24 | 252.4 ops/s | 247.3 ops/s | 282.1 ops/s | 288.7 ops/s | 13.7 ops/s | 35.6 ops/s |
|
|
113
|
+
| | Bun 1.4 | 372.0 ops/s | 272.4 ops/s | 441.5 ops/s | 405.6 ops/s | 169 ops/s | 44.5 ops/s |
|
|
114
|
+
| 20 sections x 100p + 40 images | Node 24 | 89.6 ops/s | 94.5 ops/s | 103.6 ops/s | 103.7 ops/s | 3.53 ops/s | 1.73 ops/s |
|
|
115
|
+
| | Bun 1.4 | 141.9 ops/s | 90.9 ops/s | 163.7 ops/s | 170.4 ops/s | 33.2 ops/s | 1.15 ops/s |
|
|
109
116
|
|
|
110
117
|
**Large File (~100MB) — Mixed Content**
|
|
111
118
|
|
|
112
119
|
500 styled paragraphs + 38 mixed-size images (1-5MB, 100MB total) + 50x10 table.
|
|
113
120
|
|
|
114
|
-
| Scenario | Default sync | Default async | All STORE sync | All STORE async | Default stream |
|
|
115
|
-
| ------------------------ |
|
|
116
|
-
| Mixed (500p+38img+50x10) |
|
|
121
|
+
| Scenario | Runtime | Default sync | Default async | All STORE sync | All STORE async | Default stream | docx |
|
|
122
|
+
| ------------------------ | ------- | ------------ | ------------- | -------------- | --------------- | -------------- | ---------- |
|
|
123
|
+
| Mixed (500p+38img+50x10) | Node 24 | 23.1 ops/s | 21.2 ops/s | 23.7 ops/s | 23.9 ops/s | 3.56 ops/s | 0.28 ops/s |
|
|
124
|
+
| | Bun 1.4 | 38.8 ops/s | 32.5 ops/s | 36.5 ops/s | 30.7 ops/s | 5.27 ops/s | 0.21 ops/s |
|
|
117
125
|
|
|
118
|
-
**Stream
|
|
126
|
+
**Stream** = `generateDocumentStream` (default compression, fully drained) — it targets piping and a flat memory profile, not peak throughput.
|
|
119
127
|
|
|
120
128
|
## License
|
|
121
129
|
|