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
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.
Add dependency in your mix.exs:
def deps do
[{:binary, "~> 0.0.5"}]
end
Enjoy:
iex< import Binary
iex> [1, 2] |> from_list |> pad_trailing(4) |> reverse |> split_at(-1)
{<<0, 0, 2>>, <<1>>}
MIT, check the LICENSE file. Just do whatever you like with this.
Even tiny contributions are very much welcome. Just open an issue or pull request on github.