To Reproduce
1) I created xml file from docx (this docx contain just one word which is hello) using node-stream-zip npm package using StreamZip function.
2) then I read that xml using fs npm package and stored that in one variable as string.
const xmlBuffer = fs.readFileSync(xmlFileName);
const xmlContent = xmlBuffer.toString('utf-8'); // here xml content is read correctly
3) now i want to convert back that xml to docx file, so I used fs package
fs.writeFile('output.docx', xmlContent, err => {
if (err) {
console.error('Error writing DOCX file:', err);
return;
}
console.log('DOCX file created successfully!');
});
word file is generated but it is in corrupted form, and when try to open that docx file in notepad i am able to see exact xml that come in variable xmlContent
PFA,
The methods you're using are Node.js core fs methods, not fs-extra-specific additions. I suggest trying to get help with your problem on https://stackoverflow.com/
To Reproduce 1) I created xml file from docx (this docx contain just one word which is hello) using node-stream-zip npm package using StreamZip function. 2) then I read that xml using fs npm package and stored that in one variable as string.
3) now i want to convert back that xml to docx file, so I used fs package
word file is generated but it is in corrupted form, and when try to open that docx file in notepad i am able to see exact xml that come in variable xmlContent PFA,
![image](https://github.com/jprichardson/node-fs-extra/assets/106949652/899e591d-b795-4f78-b862-d1b2d59c826f)