ryu1kn / csv-writer

Convert objects/arrays into a CSV string or write them into a CSV file
https://www.npmjs.com/package/csv-writer
MIT License
246 stars 39 forks source link

Closing of the writer after write operation #44

Closed SRoyDeveloper closed 4 years ago

SRoyDeveloper commented 4 years ago

Hi,

After the completion of the write operation (using writeRecords function) how to close the writer? I tried using writer.end() or writer.close(). Both gave errors that end or close is not a function.

Regards, Suparna

ryu1kn commented 4 years ago

Hi @SRoyDeveloper , csv-writer doesn't directly work with a file descriptor. It's using fs.writeFile("filename", ... and NOT doing fs.open / fs.close; so you don't need to manually close anything.

https://github.com/ryu1kn/csv-writer/blob/763df050307afdeeb39623b7d59a996e127b55dd/src/lib/file-writer.ts#L16

SRoyDeveloper commented 4 years ago

Hi @ryu1kn,

Thanks for the confirmation.

Regards, Suparna