44
55[ ![ Drone.io] ( https://drone.io/github.com/msgpack/msgpack-erlang/status.png )] ( https://drone.io/github.com/msgpack/msgpack-erlang )
66
7- ## prequisites for runtime
7+ ## Prerequisites for runtime
88
99[ Erlang/OTP] ( http://erlang.org/ ) , >= 17.0
1010Also based on [ the new msgpack spec 232a0d] ( https://github.com/msgpack/msgpack/blob/232a0d14c6057000cc4a478f0dfbb5942ac54e9e/spec.md ) .
@@ -33,35 +33,54 @@ Ham = msgpack:pack(Spam),
3333...
3434```
3535
36- ## String type
36+ ## Options, for packing and unpacking
3737
38- Now this supports string type!
38+ ### ` {spec, new|old} `
39+
40+ Both packing and unpacking.
41+
42+ [ old spec] ( https://github.com/msgpack/msgpack/blob/master/spec-old.md ) :
3943
4044``` erlang
41- Opt = [{enable_str , true }]
42- {ok , " 埼玉" } = msgpack :unpack (msgpack :pack (" 埼玉" , Opt ), Opt ).
43- => {ok ,[22524 ,29577 ]}
45+ OldHam = msgpack :pack (Spam , [{enable_str ,false }]),
46+ {ok , Spam } = msgpack :unpack (OldHam , [{enable_str ,false }]).
4447```
4548
46- There are several options for ` msgpack:pack/2 ` and ` msgpack:unpack/2 ` .
47- See ` msgpack:options() ` in ` msgpack.hrl ` .
49+ ### ` {allow_atom, none|pack} `
50+
51+ Only in packing
4852
49- ## Map Style
53+ ### ` {known_atoms, [atom()]} `
5054
51- Since Erlang/OTP 17.0
55+ Both in packing and unpacking
56+
57+ ### ` {str, as_binary|as_list|as_validated_list} `
58+
59+ Both in packing and unpacking. Only available at new spec.
60+
61+ Now this supports string type!
5262
5363``` erlang
54- msgpack :pack (#{ <<" key" >> => <<" value" >> }, [{format , map }]).
64+ Opt = [{enable_str , true }]
65+ {ok , " 埼玉" } = msgpack :unpack (msgpack :pack (" 埼玉" , Opt ), Opt ).
66+ => {ok ,[22524 ,29577 ]}
5567```
5668
57- Or use old jiffy/jsx style
69+
70+ ### ` {map_format, maps|jiffy|jsx} `
71+
72+ Both at packing and unpacking.
5873
5974``` erlang
75+ msgpack :pack (#{ <<" key" >> => <<" value" >> }, []).
6076msgpack :pack ({[{<<" key" >>, <<" value" >>}]}, [{format , jiffy }]),
6177msgpack :pack ([{<<" key" >>, <<" value" >>}], [{format , jsx }]).
6278```
6379
64- ## Ext type
80+
81+ ### ` {ext, {msgpack_ext_packer(), msgpack_ext_unpacker()}|module()} `
82+
83+ At both.
6584
6685Now msgpack-erlang supports ext type. Now you can serialize everything
6786with your original (de)serializer. That will enable us to handle
@@ -76,29 +95,16 @@ Opt = [{ext,{Packer,Unpacker}}],
7695{ok , {ref , Ref }} = msgpack :unpack (msgpack :pack ({ref , Ref }, Opt ), Opt ).
7796```
7897
79- This is still experimental feature, so I'm waiting for your feedback.
80-
81- ## Compatibility mode
82-
83- To use as same with [ old spec] ( https://github.com/msgpack/msgpack/blob/master/spec-old.md ) :
84-
85- ``` erlang
86- OldHam = msgpack :pack (Spam , [{enable_str ,false }]),
87- {ok , Spam } = msgpack :unpack (OldHam , [{enable_str ,false }]).
88- ```
89-
90- Since 0.2.3 now it's ** false by default** .
91-
92- ## Further tests
93-
94- See [ msgpack-erlang-tests] ( http://github.com/kuenishi/msgpack-erlang-tests ) for further tests
95-
9698## License
9799
98100Apache License 2.0
99101
100102# Release Notes
101103
104+ ## 0.5.0
105+
106+ - Renewed optional arguments to pack/unpack interface.
107+
102108## 0.4.0
103109
104110- Deprecate ` nil `
0 commit comments