Skip to content

Commit a4271cc

Browse files
committed
Merge pull request #25 from edma2/compat-mode
Implement compatibility-mode to support old spec
2 parents 1247205 + 8377769 commit a4271cc

File tree

4 files changed

+209
-142
lines changed

4 files changed

+209
-142
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,5 +111,19 @@ You can also define your own Extended types with `extend-msgpack`.
111111
; => (#user.Person{:name "bob"} 5 "test")
112112
```
113113

114+
### Options
115+
All pack and unpack functions take an optional map of options:
116+
* `:compatibility-mode`
117+
Serialize/deserialize strings and bytes using the raw-type defined here:
118+
https://github.com/msgpack/msgpack/blob/master/spec-old.md
119+
120+
Note: No error is thrown if an unpacked value is reserved under the old spec
121+
but defined under the new spec. We always deserialize something if we can
122+
regardless of `compatibility-mode`.
123+
124+
```clojure
125+
(msg/pack (byte-array (byte 9)) {:compatibility-mode true})
126+
```
127+
114128
## License
115129
clojure-msgpack is MIT licensed. See the included LICENSE file for more details.

0 commit comments

Comments
 (0)