Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/meh/cesso
CSV handling library for Elixir.
https://github.com/meh/cesso
Last synced: 22 days ago
JSON representation
CSV handling library for Elixir.
- Host: GitHub
- URL: https://github.com/meh/cesso
- Owner: meh
- Created: 2013-11-28T09:09:46.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-06-18T17:29:29.000Z (over 10 years ago)
- Last Synced: 2024-10-06T04:42:22.793Z (about 1 month ago)
- Language: Elixir
- Size: 266 KB
- Stars: 26
- Watchers: 4
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- freaking_awesome_elixir - Elixir - CSV handling library for Elixir. (CSV)
- fucking-awesome-elixir - cesso - CSV handling library for Elixir. (CSV)
- awesome-elixir - cesso - CSV handling library for Elixir. (CSV)
README
cesso - CSV parser for Elixir
=============================
Simple library to parse CSV lazily, especially made to parse huge exported
databases.Examples
--------```elixir
use CessoCSV.decode(~s)
|> IO.inspect # => [["lol", "wut"]]# string columns are supported
CSV.decode(~s)
|> IO.inspect # => [["lol", "wut,omg"]]# they can also span multiple lines
CSV.decode(~s)
|> IO.inspect # => [["lol", "wut\nomg", "hue"]]# you can also specify a different separator
CSV.decode(~s, separator: "|||")
|> IO.inspect # => [["lol", "wut"]]# the first row can be used as column names
CSV.decode(~s, columns: true)
|> IO.inspect [[{ "a", "lol" }, { "b", "wut" }]]# otherwise you can pass the column names
CSV.decode(~s, columns: ["a", "b"])
|> IO.inspect [[{ "a", "lol" }, { "b", "wut" }]]# you can also parse a file
CSV.decode(File.stream!("db.csv"))
```