I'm trying to use execa to convert stdin to a docx file. The promise I await is hanging and never completes. I've tried terminating stdin with a \\n
, but that doesn't work.
const process = execa('pandoc', ['-', '-o', 'file.docx'])
process.stdin.write('input to be made into a docx file')
process.stdin.write('\n')
const result = await process
Okay I got it. Node writable streams have a end()
method.
const process = execa('pandoc', ['-', '-o', 'file.docx'])
process.stdin.write('input to be made into a docx file')
process.stdin.end();
const result = await process
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.