Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bcpeinhardt/gsv
A simple csv parser and encoder written in gleam
https://github.com/bcpeinhardt/gsv
Last synced: about 2 months ago
JSON representation
A simple csv parser and encoder written in gleam
- Host: GitHub
- URL: https://github.com/bcpeinhardt/gsv
- Owner: bcpeinhardt
- Created: 2023-05-24T02:54:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-01T17:44:26.000Z (8 months ago)
- Last Synced: 2024-03-15T00:49:46.406Z (6 months ago)
- Language: Gleam
- Homepage:
- Size: 33.2 KB
- Stars: 3
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
- awesome-gleam - gsv - [📚](https://hexdocs.pm/gsv/) - A simple csv parser and generator written in gleam (Packages / Formats)
README
# gsv
[![Package Version](https://img.shields.io/hexpm/v/gsv)](https://hex.pm/packages/gsv)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/gsv/)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](https://datatracker.ietf.org/doc/html/rfc4180#section-2)
#### Example
```gleam
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:
```sh
gleam add gsv
```and its documentation can be found at .