Liking cljdoc? Tell your friends :D

taoensso.msgpack

Clj/s MessagePack implementation adapted from `msgpack-cljc` by @rosejn.

*auto-cache-keywords?*clj/s

Experimental, subject to change. Feedback welcome!

When true, packing automatically caches repeated keyword occurrences. Keep
false until all readers support the new encoding.
source

*shared-dict*clj/s

Experimental, subject to change. Feedback welcome!

Shared dictionary to use when packing/unpacking, nil by default.
Prefer `:shared-dict` options where available.
source

packclj/s≠

(pack clj)
(pack output clj)
clj
1 arity: returns MessagePack-encoded byte[] for given Clj value.
2 arity: writes  MessagePack-encoded bytes  for given Clj value to
  given DataOutput and returns the DataOutput.
cljs
1 arity: returns MessagePack-encoded Uint8Array for given Cljs value.
2 arity: writes  MessagePack-encoded bytes      for given Cljs value to
  given output ∈ #{Uint8Array ArrayBuffer DataView subs} and returns an
  output stream that can be dereffed to get Uint8Array.
source (clj)source (cljs)

shared-dictclj/s

(shared-dict entries)
Experimental, subject to change. Feedback welcome!

Given a non-empty ordered sequence of up to 65536 distinct keywords and/or
non-empty strings, returns an immutable precompiled dictionary for repeated
use.

A dictionary is part of the encoding: version and store its definition with
your code, ordering frequent entries first (the first 256 use smaller refs).
Unpacking requires the same ordered prefix. Never remove or reorder entries;
appending is backwards compatible when readers are upgraded before writers.
The fingerprint detects accidental schema mismatch; it is not cryptographic.
Entries are referenced anywhere they occur, and decoded strings reuse the
dictionary's instance. Payloads without dictionary references have no
dictionary overhead. Deref to recover the entries.
source

unpackclj/s≠

(unpack input)
(unpack input
        {:keys [max-value-bytes max-collection-items max-nesting-depth]
         :as opts})
clj
Returns Clj value for given MessagePack-encoded input ∈ #{byte[] DataInput}.

Optional limits default to 64 MiB per byte/string value, 1048576
items per collection, and 512 levels of nesting. Set an option to nil
to disable that limit. See `shared-dict` for the `:shared-dict` option.
cljs
Returns Cljs value for given MessagePack-encoded input
∈ #{Uint8Array ArrayBuffer DataView subs}.
Decoded binary values may share the input's backing buffer.

Optional limits default to 64 MiB per byte/string value, 1048576
items per collection, and 512 levels of nesting. Set an option to nil
to disable that limit. See `shared-dict` for the `:shared-dict` option.
source (clj)source (cljs)

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close