Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/comboy/elixir-binary
Library for handling binaries in Elixir.
https://github.com/comboy/elixir-binary
Last synced: about 2 months ago
JSON representation
Library for handling binaries in Elixir.
- Host: GitHub
- URL: https://github.com/comboy/elixir-binary
- Owner: comboy
- License: mit
- Created: 2017-04-19T13:55:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-20T21:01:41.000Z (over 6 years ago)
- Last Synced: 2023-10-01T19:02:48.917Z (over 1 year ago)
- Language: Elixir
- Homepage:
- Size: 18.6 KB
- Stars: 19
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Elixir Binary
Small library for handling binaries in Elixir. It's a wrapper around erlang :binary, plus a few String-alike functions.
When using it instead of erlang's :binary you get more sexy code and typespecs, plus you get some functions that String offers
like `reverse/1`, `trim_trailing/2` etc. You should not use String for binaries becaues it operates on codepoints, not bytes.Full list of functions can be found on [hexdocs](https://hexdocs.pm/binary/Binary.html)
In edge cases, the behavior is modeled after `Elixir.String`. API will be frozen with version 0.1.0. I'm hoping to collect some
feedback first, but I don't plan any breaking API changes.## Usage
Add dependency in your mix.exs:
```elixir
def deps do
[{:binary, "~> 0.0.5"}]
end
```Enjoy:
```elixir
iex< import Binary
iex> [1, 2] |> from_list |> pad_trailing(4) |> reverse |> split_at(-1)
{<<0, 0, 2>>, <<1>>}
```## License
MIT, check the [LICENSE](LICENSE) file. Just do whatever you like with this.
## Contributing
Even tiny contributions are very much welcome. Just open an issue or pull request on [github](https://github.com/comboy/elixir-binary).