All Projects → justone → brisk

justone / brisk

Licence: EPL-2.0 license
Freeze and thaw with Nippy at the command line

Programming Languages

clojure
4091 projects
shell
77523 projects

brisk

Freeze and thaw with Nippy at the command line.

Install

Download the latest from the releases page.

Usage

Freeze data:

brisk --freeze -i data.edn -o data.nippy

Thaw data:

brisk --thaw -i data.nippy -o data.edn

If input or output is not specified, stdin or stdout will be used:

cat data.edn | brisk -f | brisk -t > data2.edn

Encryption

Brisk supports reading and writing encrypted Nippy data. See these docs for details about the difference between cached and salted passwords.

Freeze and thaw data (encrypted):

brisk --freeze --salted-password supersecret -i data.edn -o data.nippy
brisk --thaw --salted-password supersecret -i data.nippy -o data.edn

See brisk --help for more options, including passing the password with environment variables.

Babashka pod support

There are four functions exposed via the pod interface:

  • (freeze-to-file filename data) - freeze data to file, returns the number of bytes written
  • (thaw-from-file filename) - returns data thawed from the file
  • (freeze-to-string data) - returns frozen data as an encoded string
  • (thaw-from-string encoded) - returns data thawed from the encoded string

Any of the above can take an additional argument with options. This can be used to encrypt the frozen data.

Example:

#!/usr/bin/env bb

(require '[babashka.pods :as pods])
(pods/load-pod "brisk")
(require '[pod.brisk :as brisk])

(brisk/freeze-to-file "pod.nippy" {:han :solo})
(prn (brisk/thaw-from-file "pod.nippy"))

(brisk/freeze-to-file "pod.encrypted.nippy" {:han :solo} {:password [:cached "my-password"]})
(prn (brisk/thaw-from-file "pod.encrypted.nippy" {:password [:cached "my-password"]}))

Development

Not quite ready yet. This depends on a soon-to-be-released library.

Things that don't work

  • Embedded objects - Nippy can handle them, but Graal VM does not support them.

License

Copyright © 2020-2022 Nate Jones

Distributed under the EPL License. See LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].