Read and write data encoded in edn.
write
is strict in that it checks whether what it will write is actually readable.
This makes writing records impossible.
Read and write data encoded in edn. `write` is strict in that it checks whether what it will write is actually readable. This makes writing records impossible.
Implement read and write operation for reading and writing data to Uint8Array.
When implementing these functions keep in mind that:
Implement read and write operation for reading and writing data to Uint8Array. When implementing these functions keep in mind that: - the format is bypassed for messages containing {:empty? true} (ie no need to handle writing/reading "") - an error should be thrown when reading/writings fails (or would write non-readable data). This signals to the caller that the formatting failed.
(-write format value)
(-read format arraybuffer)
(read format)
(read format msg)
Applies format
to :payload of msg
or yields a reader when no msg
given.
When msg
contains [:empty? true], the empty-format is used instead of format
.
format
can be one of payload-formats, or a reify of PayloadFormat.
Yields [err msg-with-formatted-payload] Possible err's:
Examples: (read :json {:payload #js [34,97,34]) ;; => [nil {:payload "a"}]
(read :json {:empty? true :payload #js [34,97,34]) ;; => [nil {:empty? true :payload ""}]
Applies `format` to :payload of `msg` or yields a reader when no `msg` given. When `msg` contains [:empty? true], the empty-format is used instead of `format`. `format` can be one of payload-formats, or a reify of PayloadFormat. Yields [err msg-with-formatted-payload] Possible err's: - :unknown-format - :format-error Examples: (read :json {:payload #js [34,97,34]) ;; => [nil {:payload "a"}] (read :json {:empty? true :payload #js [34,97,34]) ;; => [nil {:empty? true :payload ""}]
Read and write data encoded in transit+json.
Read and write data encoded in transit+json.
(write format)
(write format msg)
Applies format
to :payload of msg
or yields a writer when no msg
given.
When msg
has [:empty? true], the empty-format is used instead of format
.
format
can be one of payload-formats
, or a reify of PayloadFormat.
Yields [err msg-with-formatted-payload] Possible err's:
Examples: (write :json {:payload "a") ;; => [nil {:payload #object[Uint8Array 34,97,34]}]
(write :json {:empty? true :payload "a"} ;; => [nil {:payload #object[Uint8Array ]}]
Applies `format` to :payload of `msg` or yields a writer when no `msg` given. When `msg` has [:empty? true], the empty-format is used instead of `format`. `format` can be one of `payload-formats`, or a reify of PayloadFormat. Yields [err msg-with-formatted-payload] Possible err's: - :unknown-format - :format-error Examples: (write :json {:payload "a") ;; => [nil {:payload #object[Uint8Array 34,97,34]}] (write :json {:empty? true :payload "a"} ;; => [nil {:payload #object[Uint8Array ]}]
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close