Elixir implementation bundle for MessagePack
Elixir implementation relies on mururu/msgpack-elixir
Pure erlang implementation used with msgpack/msgpack-erlang
### In pure elixir:
# pack
TheAlchemist.pack([1,2,3]) #=> { :ok, <<147,1,2,3>> }
TheAlchemist.pack!([1,2,3]) #=> <<147,1,2,3>>
# unpack
TheAlchemist.unpack(<<147,1,2,3>>) #=> { :ok, [1,2,3] }
TheAlchemist.unpack!(<<147,1,2,3>>) #=> [1,2,3]
# unpack_once
TheAlchemist.unpack_once(<<147,1,2,3,4>>) #=> {:ok, {[1, 2, 3], <<4>>}}
TheAlchemist.unpack_once!(<<147,1,2,3,4>>) #=> {[1, 2, 3], <<4>>}
### With underlying erlang:
msgpacked = TheAlchemistErl.pack('{"test":false}')
TheAlchemistErl.unpack(msgpacked)
mat = TheAlchemistErl.unpack_stream(data)
TheAlchemistErl.unpack_stream(elem(mat, 1)),
Now this supports string type!
opt = [{:enable_str, true}]
TheAlchemistErl.unpack(TheAlchemistErl.pack("埼玉kanji", opt), opt)
=> {:ok, "埼玉kanji"}
Since Erlang/OTP 17.0
msgpack:pack(#{ <<"key">> => <<"value">> }, [{format, map}]).
Or use old jiffy/jsx style
msgpack:pack({[{<<"key">>, <<"value">>}]}, [{format, jiffy}]),
msgpack:pack([{<<"key">>, <<"value">>}], [{format, jsx}]).
Firstly make all
to ensure all source files are compiled
after that you can bring the ERL shell
with
make run
If you want to bring the IEX
you can type
make runex