zstd/contrib/single_file_decoder
Carl Woffenden 88975e8c25 Minor: documented sizes smaller 2019-09-02 18:15:31 +02:00
..
examples Minor: documented sizes smaller 2019-09-02 18:15:31 +02:00
.gitignore changed contrib project name for clarity 2019-08-27 15:50:47 -07:00
README.md Correctness and tidy 2019-09-02 18:02:50 +02:00
build_test.sh Correctness and tidy 2019-09-02 18:02:50 +02:00
combine.sh Correctness and tidy 2019-09-02 18:02:50 +02:00
create_single_file_decoder.sh fix create_ script for sh 2019-08-28 13:23:48 -07:00
zstddeclib-in.c Merge branch 'dev' into decTest 2019-08-29 09:48:12 -07:00

README.md

Single File Zstandard Decompression Library

The script combine.sh creates an amalgamated source file that can be used with or without zstd.h. This isn't a header-only file but it does offer a similar level of simplicity when integrating into a project.

Create zstddeclib.c from the Zstd source using:

cd zstd/contrib/declib
./combine.sh -r ../../lib -r ../../lib/common -r ../../lib/decompress -o zstddeclib.c zstddeclib-in.c

Then add the resulting file to your project (see the example files).

create_single_file_decoder.sh will run the above script, creating file zstddeclib.c. build_test.sh will create the decoder, then compile and test the library.

Why?

Because all it now takes to support decompressing Zstd is the addition of a single file, two if using the header, with no configuration or further build steps. The library is small, adding, for example, 26kB to an Emscripten compiled WebAssembly project. Native implementations add a little more, 40-70kB depending on the compiler and platform.