node-csv icon indicating copy to clipboard operation
node-csv copied to clipboard

Export stream interface for browsers (esm)

Open thiemok opened this issue 1 year ago • 5 comments

Summary

From what i can gather from #444 and the exported types in dist/esm/stream there is in theory a working implementation for web streams. However there seems to be no /stream export for esm and parse imported from csv-parse/browser/esm does not return an object that would be usable as TranformStream. Could you export the webstream variant for esm?

Motivation

I would like to be able use the same csv parsing library in both backend and frontend in order to minimize issues caused by differences in parsing behaviour.

thiemok avatar Dec 09 '24 14:12 thiemok

Were you able to figure out how to use the ESM version?

focux avatar Jan 03 '25 15:01 focux

Have you tried to import csv-parse/stream' and not csv/stream` ? It shall work.

wdavidw avatar Jan 04 '25 17:01 wdavidw

Forgot to update my comment but yeah, that worked for me.

focux avatar Jan 04 '25 18:01 focux

Sorry for the late reply. The csv-parse/stream import path did not work for me, because it pulls in node:stream/web which isn't available in a browser context.

However I'm no longer involved in the project that required this, so feel free to close

thiemok avatar Feb 21 '25 08:02 thiemok

OK, thank you for the feedback. Let's leave the issue open for now as web stream need to be addressed properly at some point.

wdavidw avatar Feb 21 '25 08:02 wdavidw