Logo

0x5a.live

for different kinds of informations and explorations.

GitHub - mururu/msgpack-elixir: MessagePack Implementation for Elixir / msgpack.org[Elixir]

MessagePack Implementation for Elixir / msgpack.org[Elixir] - mururu/msgpack-elixir

Visit SiteGitHub - mururu/msgpack-elixir: MessagePack Implementation for Elixir / msgpack.org[Elixir]

GitHub - mururu/msgpack-elixir: MessagePack Implementation for Elixir / msgpack.org[Elixir]

MessagePack Implementation for Elixir / msgpack.org[Elixir] - mururu/msgpack-elixir

Powered by 0x5a.live ๐Ÿ’—

MessagePack for Elixir

Build Status

Installation

Add :message_pack as a dependency in your mix.exs file.

defp deps do
  [{:message_pack, "~> 0.2.0"}]
end

Usage

# pack
MessagePack.pack([1,2,3]) #=> { :ok, <<147,1,2,3>> }
MessagePack.pack!([1,2,3]) #=> <<147,1,2,3>>

# unpack
MessagePack.unpack(<<147,1,2,3>>) #=> { :ok, [1,2,3] }
MessagePack.unpack!(<<147,1,2,3>>) #=> [1,2,3]

# unpack_once
MessagePack.unpack_once(<<147,1,2,3,4>>) #=> {:ok, {[1, 2, 3], <<4>>}}
MessagePack.unpack_once!(<<147,1,2,3,4>>) #=> {[1, 2, 3], <<4>>}

Options

  • enable_string

Support string type. This options is false by default.

iex(1)> { :ok, bin } = MessagePack.pack(<<255>>)
{:ok, <<161, 255>>}
iex(3)> MessagePack.unpack(<<161, 255>>)
{:ok, <<255>>}
iex(4)> MessagePack.unpack(<<161, 255>>, enable_string: true)
{:error, {:invalid_string, <<255>>}}
  • ext

Support extention type.

See test/message_pack_ext_test.exs.

License

MIT

Elixir Resources

are all listed below.

Resources

listed to get explored on!!

Made with โค๏ธ

to provide different kinds of informations and resources.