Skip to content

Commit

Permalink
Add zstd decompression support #611 (#648)
Browse files Browse the repository at this point in the history
Closes #611.
  • Loading branch information
Jaifroid authored Sep 29, 2020
1 parent b002ed2 commit 0c53010
Show file tree
Hide file tree
Showing 11 changed files with 13,958 additions and 21 deletions.
1 change: 1 addition & 0 deletions emscripten/zstandard/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
emcc --memory-init-file 0 -O3 --closure 1 -s ENVIRONMENT="web" -s WASM=0 -s MALLOC="emmalloc" -s TOTAL_MEMORY=140247040 -s FILESYSTEM=0 -s DOUBLE_MODE=0 -s DYNAMIC_EXECUTION=0 -s MIN_IE_VERSION=11 -s EXPORT_NAME="ZD" -s MODULARIZE=1 -s EXPORTED_FUNCTIONS="['_malloc', '_free', '_ZSTD_createDStream', '_ZSTD_initDStream', '_ZSTD_decompressStream', '_ZSTD_isError', '_ZSTD_getErrorName', '_ZSTD_freeDStream', '_ZSTD_DStreamInSize', '_ZSTD_DStreamOutSize']" -s EXPORTED_RUNTIME_METHODS="['cwrap']" *.c -o zstddec.js
8 changes: 8 additions & 0 deletions emscripten/zstandard/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Source code and compilations of zstandard decompression library

The file `zstddeclib.c` is the single-file source code for the zstandard decompressor (compressor is not included).
It has been combined by following the instructions at https://github.com/facebook/zstd/tree/dev/contrib/single_file_libs. It can be used as the source file of an Emscripten webassembly or asm compilation.

The source code can be compiled with Emscripten by setting up the Emscripten SDK and running the Linux script `./compile.sh` in this directory. This will produce `zstddec.js`. Further optimization and minification of this file may be possible by adjusting the commandline options in `compile.sh`.

For a fuller Emscripten distribution of the full zstandard library for `node.js`, see https://github.com/yoshihitoh/zstd-codec/tree/develop/js/example.
66 changes: 66 additions & 0 deletions emscripten/zstandard/zstddec_optimized.js

Large diffs are not rendered by default.

Loading

0 comments on commit 0c53010

Please sign in to comment.