Module

Node.Stream.CSV.Stringify

Package
purescript-csv-stream
Repository
cakekindel/purescript-csv-stream

#CSVWrite Source

#CSVStringifier Source

type CSVStringifier :: Row Type -> Row Type -> Typetype CSVStringifier a r = Stream (csv :: CSVWrite, read :: Read, write :: Write | r)

Stream transforming rows of stringified CSV values to CSV-formatted rows.

Write rows to the stream using write.

Stringified rows are emitted on the Readable end as string chunks, meaning it can be treated as a Node.Stream.Readable that has had setEncoding UTF8 invoked on it.

#Config Source

type Config :: Row Type -> Row Typetype Config r = (bom :: Boolean, delimiter :: String, escape :: String, escape_formulas :: Boolean, header :: Boolean, quote :: String, quoted :: Boolean, quoted_empty :: Boolean, quoted_match :: Regex, quoted_string :: Boolean, record_delimiter :: String | r)

https://csv.js.org/stringify/options/

#makeImpl Source

makeImpl :: forall r. Foreign -> Effect (Stream r)

#writeImpl Source

writeImpl :: forall r. Stream r -> Array String -> Effect Unit

#recordToForeign Source

#make Source

make :: forall @r rl @config @missing @extra. Keys rl => RowToList r rl => WriteCSVRecord r rl => Union config missing (Config extra) => Record config -> Effect (CSVStringifier r ())

Create a CSVStringifier

#stringify Source

stringify :: forall @r rl f @config missing extra. Keys rl => Foldable f => RowToList r rl => WriteCSVRecord r rl => Union config missing (Config extra) => Record config -> f (Record r) -> Aff String

Synchronously stringify a collection of records

#write Source

write :: forall @r rl a. RowToList r rl => WriteCSVRecord r rl => CSVStringifier r a -> Record r -> Effect Unit

Write a record to a CSVStringifier.

The record will be emitted on the Readable end of the stream as a string chunk.

#foreach Source

foreach :: forall r x. CSVStringifier r x -> (String -> Aff Unit) -> Aff Unit

Loop until the stream is closed, invoking the callback with each chunk of stringified CSV text.

#readAll Source

readAll :: forall r a. CSVStringifier r a -> Aff String

Read the stringified chunks until end-of-stream, returning the entire CSV string.