Open aylusltd opened 1 year ago
The file is a two line docx. Confirmed it opens in word. Contents is
This is a demonstration template
{{velocity_graph}}
No formatting is applied.
Should have included:
"node_modules/docx": {
"version": "8.2.2",
"resolved": "https://registry.npmjs.org/docx/-/docx-8.2.2.tgz",
"integrity": "sha512-dWI5WfD/fDCLdjIA7CcDzV/1uyBD+mmr7jDLTUN997hcbPz56E701Kf1EEWdibdH9kk+0tFSmE+C0jTlkRZ7kQ==",
"dependencies": {
"@types/node": "^20.3.1",
"jszip": "^3.10.1",
"nanoid": "^4.0.2",
"xml": "^1.0.1",
"xml-js": "^1.6.8"
},
"engines": {
"node": ">=10"
}
},
And since the bug is likely in jszip:
"node_modules/jszip": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz",
"integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==",
"dependencies": {
"lie": "~3.3.0",
"pako": "~1.0.2",
"readable-stream": "~2.3.6",
"setimmediate": "^1.0.5"
}
},
I was able to create a working local version of patchDocument
by replacing JSZip with adm-zip and making some other minor alterations to the files. Unfortunately I can't make a PR with what I have. Will try to do it next week.
interesting, does regular document creation work for you? that uses jszip too
Having some issues in Deno with jszip
too (#1578) and adm-zip
looks kinda nice.
Maybe replacing the lib can fix both issues? 😄
@dolanmiu dunno, we never actually do that. We started with a word template and had to update. We wound up switching just to straight pdf generation though.
So simple reproduction:
TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received type number (80)
I've confirmed path is valid, and can be opened by the process.
console.log(f.length)
prints the file length in bytes.for reference:
Running on: Node v18.14.2 Ubuntu 22.04