uBlock/src/lib/lz4
Dominik 'Rathann' Mierzejewski 798338e7fa use WebAssembly-1.0 compliant function names
These functions were renamed in 2018, before the WebAssembly 1.0 spec
was finalized. wabt 1.0.25 dropped support for pre-1.0 names and the
sources fail to compile with errors like:

```
$ wat2wasm lz4-block-codec.wat
lz4-block-codec.wat:71:5: error: unexpected token get_local, expected ).
    get_local $ilen
    ^^^^^^^^^
lz4-block-codec.wat:78:5: error: unexpected token get_local.
    get_local $ilen
    ^^^^^^^^^
```
2022-05-22 17:34:12 +02:00
..
lz4-block-codec-any.js Fix Promise chain of WASM module load operations 2019-02-01 08:20:43 -05:00
lz4-block-codec-js.js Fix Promise chain of WASM module load operations 2019-02-01 08:20:43 -05:00
lz4-block-codec-wasm.js Fix Promise chain of WASM module load operations 2019-02-01 08:20:43 -05:00
lz4-block-codec.wasm reorganize cache storage compression; workaround fix for #2812 2018-08-11 10:39:43 -04:00
lz4-block-codec.wat use WebAssembly-1.0 compliant function names 2022-05-22 17:34:12 +02:00
README.md Fix typos in README, docs, and JS comments 2022-03-13 08:56:26 -04:00

Purpose

The purpose of this library is to implement LZ4 compression/decompression, as documented at the official LZ4 repository:

https://github.com/lz4/lz4/blob/dev/doc/lz4_Block_format.md

The files in this directory are developed as a separate project at:

https://github.com/gorhill/lz4-wasm

Files

lz4-block-codec-any.js

The purpose is to instanciate a WebAssembly- or pure javascript-based LZ4 block codec.

If the chosen implementation is not specified, there will be an attempt to create a WebAssembly-based instance. If for whatever reason this fails, a pure javascript-based instance will be created.

The script for either instance are dynamically loaded and only when needed, such that no resources are wasted by keeping in memory code which won't be used.

lz4-block-codec-wasm.js

This contains the code to instanciate WebAssembly-based LZ4 block codec. Note that the WebAssembly module is loaded using a same-origin fetch, hence ensuring that no code outside the package is loaded.

lz4-block-codec-js.js

This contains the code to instanciate pure javascript-based LZ4 block codec.

This is used as a fallback implementation should WebAssembly not be available for whatever reason.

lz4-block-codec.wasm

This is the WebAssembly module, loaded by lz4-block-codec-wasm.js using a same-origin fetch.

lz4-block-codec.wat

The WebAssembly source code used to generate the WebAssembly module lz4-block-codec.wasm.

wat2wasm ./lz4-block-codec.wat -o ./lz4-block-codec.wasm
wasm-opt ./lz4-block-codec.wasm -O4 -o ./lz4-block-codec.wasm

You can get wat2wasm at https://github.com/WebAssembly/wabt, and wasm-opt at https://github.com/WebAssembly/binaryen.