@office-open/docx 0.4.5 → 0.5.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 -26
- package/dist/chunk-BY251N0e.mjs +1 -0
- package/dist/index.d.mts +2991 -2949
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +10 -26037
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/_chunks/chunk-DmsbSTSH.mjs +0 -27
package/README.md
CHANGED
|
@@ -49,21 +49,21 @@ import { Document, Paragraph, TextRun, Packer } from "@office-open/docx";
|
|
|
49
49
|
import { writeFileSync } from "node:fs";
|
|
50
50
|
|
|
51
51
|
const doc = new Document({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
sections: [
|
|
53
|
+
{
|
|
54
|
+
children: [
|
|
55
|
+
new Paragraph({
|
|
56
|
+
children: [
|
|
57
|
+
new TextRun("Hello World"),
|
|
58
|
+
new TextRun({
|
|
59
|
+
text: " - Bold text",
|
|
60
|
+
bold: true,
|
|
61
|
+
}),
|
|
62
|
+
],
|
|
63
|
+
}),
|
|
64
|
+
],
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
const buffer = await Packer.toBuffer(doc);
|
|
@@ -82,27 +82,27 @@ Performance comparison against original `docx` (9.6.1) package (Windows 11 / Nod
|
|
|
82
82
|
|
|
83
83
|
| Scenario | @office-open/docx | docx | Speedup |
|
|
84
84
|
| ------------------------------------------------------- | ----------------: | ---------: | -------: |
|
|
85
|
-
| Simple document (2 paragraphs) |
|
|
86
|
-
| Styled paragraphs (20 paragraphs) |
|
|
87
|
-
| Table (10x5 cells) |
|
|
88
|
-
| Full featured (header/footer/headings/table/paragraphs) |
|
|
85
|
+
| Simple document (2 paragraphs) | 28.7K ops/s | 6.5K ops/s | **4.4x** |
|
|
86
|
+
| Styled paragraphs (20 paragraphs) | 29.5K ops/s | 5.1K ops/s | **5.8x** |
|
|
87
|
+
| Table (10x5 cells) | 20.8K ops/s | 4.0K ops/s | **5.2x** |
|
|
88
|
+
| Full featured (header/footer/headings/table/paragraphs) | 16.9K ops/s | 2.9K ops/s | **5.8x** |
|
|
89
89
|
|
|
90
90
|
**Create + toBuffer (end-to-end)**
|
|
91
91
|
|
|
92
92
|
| Scenario | @office-open/docx | docx | Speedup |
|
|
93
93
|
| ------------------------------------------------------- | ----------------: | --------: | -------: |
|
|
94
|
-
| Simple document (2 paragraphs) | 1,
|
|
95
|
-
| Styled paragraphs (20 paragraphs) | 1,
|
|
96
|
-
| Table (10x5 cells) | 1,
|
|
97
|
-
| Full featured (header/footer/headings/table/paragraphs) |
|
|
94
|
+
| Simple document (2 paragraphs) | 1,881 ops/s | 220 ops/s | **8.6x** |
|
|
95
|
+
| Styled paragraphs (20 paragraphs) | 1,857 ops/s | 242 ops/s | **7.7x** |
|
|
96
|
+
| Table (10x5 cells) | 1,421 ops/s | 236 ops/s | **6.0x** |
|
|
97
|
+
| Full featured (header/footer/headings/table/paragraphs) | 923 ops/s | 190 ops/s | **4.9x** |
|
|
98
98
|
|
|
99
99
|
**Large Files — Create + toBuffer**
|
|
100
100
|
|
|
101
101
|
| Scenario | @office-open/docx | docx | Speedup |
|
|
102
102
|
| --------------------------- | ----------------: | --------: | -------: |
|
|
103
|
-
| 500 paragraphs |
|
|
104
|
-
| 100×10 table |
|
|
105
|
-
| 10 sections × 50 paragraphs |
|
|
103
|
+
| 500 paragraphs | 227 ops/s | 105 ops/s | **2.2x** |
|
|
104
|
+
| 100×10 table | 170 ops/s | 78 ops/s | **2.2x** |
|
|
105
|
+
| 10 sections × 50 paragraphs | 345 ops/s | 138 ops/s | **2.5x** |
|
|
106
106
|
|
|
107
107
|
## License
|
|
108
108
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(e,t)=>()=>(e&&(t=e(e=0)),t),a=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},o=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},s=(e,t,n)=>(o(e,t,`default`),n&&o(n,t,`default`)),c=t=>r.call(t,`module.exports`)?t[`module.exports`]:o(e({},`__esModule`,{value:!0}),t);export{c as i,a as n,s as r,i as t};
|