-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Awaiting writer.end() doesn't close the original filestream as of ^2.0.0.
eg.
await writer.end()
console.log(`finished: ${await csvtojson().fromFile(filepath).length}`)
sometimes throws Error: File does not exist.
I got around this issue by manually closing the filestream:
const writer = csv_writer()
const stream = fs.createWriteStream(csv_file)
writer.pipe(stream)
json_obj.forEach((row) => writer.write(row))
writer.end()
await new Bluebird((resolve) => {
stream.on('close', resolve)
})
Metadata
Metadata
Assignees
Labels
No labels