1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#+TITLE: Guile-zstd: GNU Guile bindings to the zstd compression library
This directory contains bindings to the zstd compression library for
GNU Guile 3.0, 2.2, and 2.0:
https://facebook.github.io/zstd
Zstd (or “zstandard”) offers relatively high compression ratios
(typically better than gzip, not as good as lzip or xz) and a high
decompression throughput (noticeably higher than lzip or gzip).
These bindings provide a high-level port interface for in-process
compression and decompression. Here’s how you would compress a file and
store its result on disk:
#+begin_src scheme
(use-modules (zstd)
(rnrs io ports))
;; Create a compressed archive.
(call-with-output-file "compressed.zst"
(lambda (port)
(call-with-zstd-output-port port
(lambda (port)
(define data
;; Read the input file in memory.
(call-with-input-file "input-file.txt"
get-bytevector-all))
;; Write data to PORT.
(put-bytevector port data)))))
#+end_src
Decompression works similarly:
#+begin_src scheme
(call-with-input-file "compressed.zst"
(lambda (port)
(call-with-zstd-input-port port
(lambda (port)
;; Read decompressed data from PORT.
...))))
#+end_src
* Installing
With GNU Guix, you can install Guile-zstd straight of this source tree
by running:
#+begin_src sh
guix package -f guix.scm
#+end_src
See the =INSTALL= file for instructions on how to build from source
manually.
* Hacking
Using GNU Guix, you can enter a development environment by running:
#+begin_src sh
guix environment -CP -l guix.scm
#+end_src
You can authenticate the code in this repository by running:
#+begin_src sh
guix git authenticate \
afe022f7a1de5517dfeae66705dc21d94f4d2b0a \
3CE464558A84FDC69DB40CFB090B11993D9AEBB5
#+end_src
The command silently exits with zero on success, and errors out
otherwise. We recommend invoking it from ‘.git/hooks/pre-push’.
* Reporting Bugs
Please report bugs to <guile-user@gnu.org>.
Local Variables:
mode: org
ispell-local-dictionary: "american"
End:
|