Liking cljdoc? Tell your friends :D

io.julienvincent.msgpack


keywordize-keys-mapperclj

(keywordize-keys-mapper k)
source

packclj

(pack value)
(pack value opts)

Pack the given value into a msgpack byte-array.

Accepts an optional opts map containing:

  • :key-fn - A function accepting the key of a map being packed. Can be used to efficiently cast map keys to new types. Defaults to the stringify-keys-mapper fn.

Example:

(pack {:a 1} {:key-fn stringify-keys-mapper})
(pack [1 2 3])
Pack the given `value` into a msgpack byte-array.

Accepts an optional `opts` map containing:

- **`:key-fn`** - A function accepting the key of a map being packed. Can be
  used to efficiently cast map keys to new types. Defaults to the
  [[stringify-keys-mapper]] fn.

Example:

```clojure
(pack {:a 1} {:key-fn stringify-keys-mapper})
(pack [1 2 3])
```
sourceraw docstring

pack-streamclj

(pack-stream stream value)
(pack-stream stream value opts)

Like pack but writes the packed bytes directly into a given stream.

Like [[pack]] but writes the packed bytes directly into a given `stream`.
sourceraw docstring

stringify-keys-mapperclj

(stringify-keys-mapper k)
source

unpackclj

(unpack resource)
(unpack resource opts)

Unpack a msgpack value from a given resource.

The resource can be any one of:

  • A byte-array
  • A type implementing [[java.io.InputStream]]

Accepts an optional opts map containing:

  • :key-fn - A function accepting the key of a map being unpacked. Can be used to efficiently cast map keys to new types.

Example:

(unpack (pack {:a 1})) ;; => {"a" 1}
(unpack (pack {:a 1}) {:key-fn keywordize-keys-mapper}) ;; => {:a 1}
(unpack (io/input-stream (pack 1))) ;; => 1
Unpack a msgpack value from a given `resource`.

The `resource` can be any one of:

- A byte-array
- A type implementing [[java.io.InputStream]]

Accepts an optional `opts` map containing:

- **`:key-fn`** - A function accepting the key of a map being unpacked. Can
  be used to efficiently cast map keys to new types.

Example:

```clojure
(unpack (pack {:a 1})) ;; => {"a" 1}
(unpack (pack {:a 1}) {:key-fn keywordize-keys-mapper}) ;; => {:a 1}
(unpack (io/input-stream (pack 1))) ;; => 1
```
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close