Module
Node.Stream.CSV.Parse
- Package
- purescript-csv-stream
- Repository
- cakekindel/purescript-csv-stream
#CSVParser Source
type CSVParser :: Row Type -> Row Type -> Typetype CSVParser a r = Stream (csv :: CSVRead, read :: Read, write :: Write | r)
Stream transforming chunks of a CSV file into parsed purescript objects.
The CSV contents may be piped into this stream as Buffer or String encoded chunks.
Records can be read with read when Node.Stream.readable
is true.
#Config Source
type Config :: Row Type -> Row Typetype Config r = (bom :: Boolean, comment :: String, comment_no_infix :: Boolean, delimiter :: String, encoding :: String, escape :: String, from :: Int, from_line :: Int, group_columns_by_name :: Boolean, ignore_last_delimiters :: Boolean, info :: Boolean, ltrim :: Boolean, max_record_size :: Int, quote :: String, raw :: Boolean, record_delimiter :: String, relax_column_count :: Boolean, rtrim :: Boolean, skip_empty_lines :: Boolean, skip_records_with_empty_values :: Boolean, skip_records_with_error :: Boolean, to :: Int, to_line :: Int, trim :: Boolean | r)
#read Source
read :: forall @r rl a. RowToList r rl => ReadCSVRecord r rl => CSVParser r a -> Effect (Maybe (Record r))Reads a parsed record from the stream.
Returns Nothing when either:
- The internal buffer of parsed records has been exhausted, but there will be more (
Node.Stream.readableandNode.Stream.closedare bothfalse) - All records have been processed (
Node.Stream.closedistrue)
#dataH Source
dataH :: forall r a. EventHandle1 (CSVParser r a) (Record r)data event. Emitted when a CSV record has been parsed.