Skip to content
This repository has been archived by the owner on Mar 21, 2023. It is now read-only.
/ cl-zstd Public archive

Common Lisp library for Zstandard (de)compression using bindings to the libzstd C library

License

Notifications You must be signed in to change notification settings

glv2/cl-zstd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cl-zstd

The active repository is at https://codeberg.org/glv/cl-zstd

Description

cl-zstd is a Common Lisp library for Zstandard compression/decompression using bindings to the libzstd C library.

License

cl-zstd is released under the GPL-3 license or later. See the LICENSE file for details.

Dependencies

cl-zstd requires:

There should be a package providing libzstd in almost every GNU/Linux or *BSD distribution. For example it is called libzstd1 on Debian, zstd on Gentoo, and zstd:lib on Guix.

API

The library can be loaded with the usual:

(asdf:load-system "zstd")

or

(quicklisp:quickload "zstd")

The functions will then be available in the zstd package.

Compression

(compress-stream input output &key level) => t

Read the data from the input octet stream, compress it, and write the result to the output octet stream.

(compress-file input output &key level) => t

Read the data from the input file, compress it, and write the result to the output file.

(compress-buffer buffer &key start end level) => bytes

Read the data between the start and end offsets in the buffer, compress it, and return the resulting octet vector.

(make-compressing-stream output-stream &key level) => stream

Return a stream that will compress the bytes written to it at the given compression level and write them to the output-stream.

(with-compressing-stream (stream output-stream &key level) &body body)

Within body, stream is bound to a compressing stream for the given compression level and output-stream. The result of the last form of body is returned.

Decompression

(decompress-stream input output) => t

Read the data from the input octet stream, decompress it, and write the result to the output octet stream.

(decompress-file input output) => t

Read the data from the input file, decompress it, and write the result to the output file.

(decompress-buffer buffer &key start end) => bytes

Read the data between the start and end offsets in the buffer, decompress it, and return the resulting octet vector.

(make-decompressing-stream input-stream) => stream

Return a stream that will supply the bytes resulting from the decompression of the data read from the input-stream.

(with-decompressing-stream (stream input-stream) &body body)

Within body, stream is bound to a decompressing stream for the given input-stream. The result of the last form of body is returned.

Tests

The tests require the fiveam package. They can be run with:

(asdf:test-system "zstd")

About

Common Lisp library for Zstandard (de)compression using bindings to the libzstd C library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published