Reading and writing CSV files in a nodejs app

Hi, I’m just start out with purescript and new here.

As a first project I need to read CSV files in a nodejs app and write them out with some changes.

Is there a recommended Purescript CSV module to use for this kind of application?

Also, I tried to find general examples for reading and writing files in Purescript when running under nodejs, but couldn’t find some. Are there example for File IO via Purescript?

1 Like

There’s a ReadPrintFileContentsNode recipe in the cookbook.

IIRC from checking last time, there is no such complex CSV parsing library as haskell’s cassava. There are some simple libraries to parse CSV’s to arrays of arrays of strings, for instance.

Cool Checking it out. Thanks.

Are you referring to Text.Parsing.CSV or are there other packages to recommend?

1 Like

Yes. I cannot recommend it though, as I have never used it.

1 Like

I chose to FFI to Papa Parse in the past. It was a heck of a lot faster than the PureScript stuff because of PureScript’s slow speed of text parsing. I went from the browser hanging and crashing to nearly-instant parsing.

2 Likes

Thanks toastal. Makes sense.

I haven’t looked into calling JS libraries yet (I’m really just starting out with PS) but will check it out.

1 Like