Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beatrichartz/legacy_file
Read files using CR or CRLF or just LF into elixir and treat them all the same.
https://github.com/beatrichartz/legacy_file
carriage-return elixir file legacy line-feed stream
Last synced: 13 days ago
JSON representation
Read files using CR or CRLF or just LF into elixir and treat them all the same.
- Host: GitHub
- URL: https://github.com/beatrichartz/legacy_file
- Owner: beatrichartz
- License: mit
- Created: 2017-05-29T18:18:14.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-29T18:30:57.000Z (over 7 years ago)
- Last Synced: 2024-10-10T14:35:32.845Z (25 days ago)
- Topics: carriage-return, elixir, file, legacy, line-feed, stream
- Language: Elixir
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LegacyFile
#### You have:
Files separated by CR (carriage return_), LF (line feed), or CRLF?#### You want:
To read them all in and expose a stream of lines regardless.#### Wait! Doesn't Elixir / Erlang support this out of the box?
No. [File.Stream](https://github.com/elixir-lang/elixir/blob/v1.4.4/lib/elixir/lib/file/stream.ex#L85) uses
[IO.each__stream](https://github.com/elixir-lang/elixir/blob/v1.4.4/lib/elixir/lib/io.ex#L502) which uses
[:io.get_line](http://erlang.org/documentation/doc-5.3/lib/stdlib-1.12/doc/html/io.html#get_line%2). LF and CRLF are
handled, but not CR, which is used in some Mac OS and other legacy formats.## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `legacy_file` to your list of dependencies in `mix.exs`:```elixir
def deps do
[{:legacy_file, "~> 0.1.0"}]
end
```Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at [https://hexdocs.pm/legacy_file](https://hexdocs.pm/legacy_file).