Skip to content
/ gsv Public
forked from bcpeinhardt/gsv

A simple csv parser and encoder written in gleam

Notifications You must be signed in to change notification settings

Dan-C-Reed/gsv

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gsv

Package Version Hex Docs

This is a simple csv parser and writer for gleam. It will get more performant in the future, but if you're looking for high performance now, I'd recommend doing ffi to an existing parser in your target runtime.

We are using the grammar from rfc 4180

Example

import gsv.{Unix, Windows}

pub fn main() {
  let csv_str = "Hello, World\nGoodbye, Mars"

  // Parse a CSV string to a List(List(String))
  let assert Ok(records) = gsv.to_lists(csv_str)

  // Write a List(List(String)) to a CSV string
  let csv_str = records
  |> gsv.from_lists(separator: ",", line_ending: Windows)
}

Installation

If available on Hex this package can be added to your Gleam project:

gleam add csv

and its documentation can be found at https://hexdocs.pm/gsv.

About

A simple csv parser and encoder written in gleam

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Gleam 100.0%