Closed woosungchu closed 5 years ago
Paste the whole code here so someone can understand, the information above is scanty
The right way to do it (and I need to add it to the documentation):
var out = fs.createWriteStream(path.join(outDir, 'example.pptx'))
out.on('error', function(err) {
console.log(err)
})
out.on('finish', function(err) {
// This is the real finish in case of creating a document file.
})
docx.generate(out)
The finalize event of officegen itself representing that officegen finished to do his tasks but not the external file system write stream.
It works !!
out.on('finish', function(err) {
// This is the real finish in case of creating a document file.
})
Thank you for reply, Ziv-Barber
Environment
node -v
: [v10.15.3]npm -v
: [6.4.1]npm ls officegen
: [officegen@0.5.2]the document was successfully generated, but this can't open it
I know docx.generate() function is async method, but how can I open it Doesn't docx.generate.finalize callback function?