The zstd Reference Manual

Next: , Previous: , Up: (dir)   [Contents][Index]

The zstd Reference Manual

This is the zstd Reference Manual, version 1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed Jun 15 04:11:00 2022 GMT+0.

Table of Contents


1 Introduction

#+TITLE: cl-zstd
#+AUTHOR: Guillaume LE VAILLANT
#+DATE: 2020-12-21
#+EMAIL: glv@posteo.net
#+LANGUAGE: en
#+OPTIONS: num:nil toc:nil html-postamble:nil html-scripts:nil
#+HTML_DOCTYPE: html5

* 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 [[file:LICENSE][LICENSE]] file
for details.

* Dependencies

*cl-zstd* requires:
 - [[https://common-lisp.net/project/cffi/][cffi]]
 - [[https://github.com/glv2/cl-octet-streams][cl-octet-streams]]
 - [[https://facebook.github.io/zstd/][libzstd]]

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:

#+BEGIN_SRC lisp
(asdf:load-system "zstd")
#+END_SRC

or

#+BEGIN_SRC lisp
(quicklisp:quickload "zstd")
#+END_SRC

The functions will then be available in the ~zstd~ package.

** Compression

#+BEGIN_SRC lisp
(compress-stream input output &key level) => t
#+END_SRC

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

#+BEGIN_SRC lisp
(compress-file input output &key level) => t
#+END_SRC

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

#+BEGIN_SRC lisp
(compress-buffer buffer &key start end level) => bytes
#+END_SRC

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

** Decompression

#+BEGIN_SRC lisp
(decompress-stream input output) => t
#+END_SRC

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

#+BEGIN_SRC lisp
(decompress-file input output) => t
#+END_SRC

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

#+BEGIN_SRC lisp
(decompress-buffer buffer &key start end) => bytes
#+END_SRC

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

* Tests

The tests require the [[https://common-lisp.net/project/fiveam/][fiveam]] package. They can be run with:

#+BEGIN_SRC lisp
(asdf:test-system "zstd")
#+END_SRC


2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 zstd

Zstandard (de)compression using bindings to libzstd

Author

Guillaume Le Vaillant

License

GPL-3

Version

1.0

Dependencies
  • cffi (system).
  • cl-octet-streams (system).
Source

zstd.asd.

Child Component

src (module).


Next: , Previous: , Up: The zstd Reference Manual   [Contents][Index]

3 Modules

Modules are listed depth-first from the system components tree.


Previous: , Up: Modules   [Contents][Index]

3.1 zstd/src

Source

zstd.asd.

Parent Component

zstd (system).

Child Components

4 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

4.1 Lisp


Next: , Previous: , Up: Lisp   [Contents][Index]

4.1.1 zstd/zstd.asd

Source

zstd.asd.

Parent Component

zstd (system).

ASDF Systems

zstd.


Next: , Previous: , Up: Lisp   [Contents][Index]

4.1.2 zstd/src/package.lisp

Source

zstd.asd.

Parent Component

src (module).

Packages

zstd.


4.1.3 zstd/src/libzstd.lisp

Dependency

package.lisp (file).

Source

zstd.asd.

Parent Component

src (module).

Internals

Previous: , Up: Lisp   [Contents][Index]

4.1.4 zstd/src/zstd.lisp

Dependency

libzstd.lisp (file).

Source

zstd.asd.

Parent Component

src (module).

Public Interface
Internals

5 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

5.1 zstd

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

6 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

6.1 Public Interface


6.1.1 Macros

Macro: zstd-error (message &rest args)
Package

zstd.

Source

zstd.lisp.


Next: , Previous: , Up: Public Interface   [Contents][Index]

6.1.2 Ordinary functions

Function: compress-buffer (buffer &key start end level)

Read the data between the START and END offsets in the BUFFER, compress it, and return the resulting octet vector.

Package

zstd.

Source

zstd.lisp.

Function: compress-file (input output &key level)

Read the data from the INPUT file, compress it, and write the result to the OUTPUT file.

Package

zstd.

Source

zstd.lisp.

Function: compress-stream (input output &key level)

Read the data from the INPUT octet stream, compress it, and write the result to the OUTPUT octet stream.

Package

zstd.

Source

zstd.lisp.

Function: decompress-buffer (buffer &key start end)

Read the data between the START and END offsets in the BUFFER, decompress it, and return the resulting octet vector.

Package

zstd.

Source

zstd.lisp.

Function: decompress-file (input output)

Read the data from the INPUT file, decompress it, and write the result to the OUTPUT file.

Package

zstd.

Source

zstd.lisp.

Function: decompress-stream (input output)

Read the data from the INPUT octet stream, decompress it, and write the result to the OUTPUT octet stream.

Package

zstd.

Source

zstd.lisp.


6.1.3 Conditions

Condition: zstd-error
Package

zstd.

Source

zstd.lisp.

Direct superclasses

simple-error.


6.2 Internals


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.1 Macros

Macro: zstd-check (form)
Package

zstd.

Source

zstd.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.2 Ordinary functions

Function: compress ()

Read the data from the INPUT octet stream, compress it with the CONTEXT, and write the result to the OUTPUT octet stream.

Package

zstd.

Source

zstd.lisp.

Function: decompress ()

Read the data from the INPUT octet stream, decompress it with the CONTEXT, and write the result to the OUTPUT octet stream.

Package

zstd.

Source

zstd.lisp.

Function: initialize-context (context level)

Initialize the CONTEXT for the given compression LEVEL.

Package

zstd.

Source

zstd.lisp.

Function: zstd-c-stream-in-size ()

Recommended size for compression input buffer.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-c-stream-out-size ()

Recommended size for compression output buffer.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-cctx-set-parameter (cctx param value)

Set one compression parameter.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-compress-stream2 (cctx output input endop)

Compress the data with additional control on end directive.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-create-cctx ()

Create a compression context.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-create-dctx ()

Create a decompression context.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-d-stream-in-size ()

Recommended size for decompression input buffer.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-d-stream-out-size ()

Recommended size for decompression output buffer.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-decompress-stream (zds output input)

Decompress the data.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-free-cctx (cctx)

Free a compression context.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-free-dctx (dctx)

Free a decompression context.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-get-error-name (code)

Return a readable string from an error code.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-is-error (code)

Tell if a function result is an error code.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-max-c-level ()

Maximum compression level available.

Package

zstd.

Source

libzstd.lisp.

Function: zstd-min-c-level ()

Minimum compression level available.

Package

zstd.

Source

libzstd.lisp.


Next: , Previous: , Up: Internals   [Contents][Index]

6.2.3 Classes

Class: zstd-in-buffer-tclass
Package

zstd.

Source

libzstd.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.
Class: zstd-out-buffer-tclass
Package

zstd.

Source

libzstd.lisp.

Direct superclasses
  • foreign-struct-type.
  • translatable-foreign-type.

Previous: , Up: Internals   [Contents][Index]

6.2.4 Types

Type: i32 ()
Package

zstd.

Source

libzstd.lisp.

Type: u32 ()
Package

zstd.

Source

libzstd.lisp.

Type: u64 ()
Package

zstd.

Source

libzstd.lisp.

Type: u8 ()
Package

zstd.

Source

zstd.lisp.


Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts


Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   C   D   F   I   M   Z  
Index Entry  Section

C
compress: Private ordinary functions
compress-buffer: Public ordinary functions
compress-file: Public ordinary functions
compress-stream: Public ordinary functions

D
decompress: Private ordinary functions
decompress-buffer: Public ordinary functions
decompress-file: Public ordinary functions
decompress-stream: Public ordinary functions

F
Function, compress: Private ordinary functions
Function, compress-buffer: Public ordinary functions
Function, compress-file: Public ordinary functions
Function, compress-stream: Public ordinary functions
Function, decompress: Private ordinary functions
Function, decompress-buffer: Public ordinary functions
Function, decompress-file: Public ordinary functions
Function, decompress-stream: Public ordinary functions
Function, initialize-context: Private ordinary functions
Function, zstd-c-stream-in-size: Private ordinary functions
Function, zstd-c-stream-out-size: Private ordinary functions
Function, zstd-cctx-set-parameter: Private ordinary functions
Function, zstd-compress-stream2: Private ordinary functions
Function, zstd-create-cctx: Private ordinary functions
Function, zstd-create-dctx: Private ordinary functions
Function, zstd-d-stream-in-size: Private ordinary functions
Function, zstd-d-stream-out-size: Private ordinary functions
Function, zstd-decompress-stream: Private ordinary functions
Function, zstd-free-cctx: Private ordinary functions
Function, zstd-free-dctx: Private ordinary functions
Function, zstd-get-error-name: Private ordinary functions
Function, zstd-is-error: Private ordinary functions
Function, zstd-max-c-level: Private ordinary functions
Function, zstd-min-c-level: Private ordinary functions

I
initialize-context: Private ordinary functions

M
Macro, zstd-check: Private macros
Macro, zstd-error: Public macros

Z
zstd-c-stream-in-size: Private ordinary functions
zstd-c-stream-out-size: Private ordinary functions
zstd-cctx-set-parameter: Private ordinary functions
zstd-check: Private macros
zstd-compress-stream2: Private ordinary functions
zstd-create-cctx: Private ordinary functions
zstd-create-dctx: Private ordinary functions
zstd-d-stream-in-size: Private ordinary functions
zstd-d-stream-out-size: Private ordinary functions
zstd-decompress-stream: Private ordinary functions
zstd-error: Public macros
zstd-free-cctx: Private ordinary functions
zstd-free-dctx: Private ordinary functions
zstd-get-error-name: Private ordinary functions
zstd-is-error: Private ordinary functions
zstd-max-c-level: Private ordinary functions
zstd-min-c-level: Private ordinary functions

Jump to:   C   D   F   I   M   Z  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables