Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
platypii committed Apr 16, 2024
1 parent 9f540bb commit bcab9b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ For example, snappy is the default compression format for [Apache Parquet](https

## Usage

The `snappyUncompress` function expects as arguments: a typed array `compressed`, and an `outputLength` parameter.
The length is needed to know how much wasm memory to allocate.
For formats like parquet, this length will generally be known in advance.
To decompress a `Uint8Array` with known output length:

```js
Expand Down Expand Up @@ -58,11 +61,12 @@ Run `make` to build from source. The build process consists of:

## WASM Loading

By keeping `hysnappy.wasm` under 4kb, we can include it directly in the `hysnappy.js` file and load the WASM blob synchronously, which is faster than loading a separate `.wasm` file.
By keeping `hysnappy.wasm` under 4kb, we can include it directly in the `hysnappy.js` file and load the WASM blob synchronously, which is faster than loading a separate `.wasm` file. [[web.dev]](https://web.dev/articles/loading-wasm)

## References

- https://en.wikipedia.org/wiki/Snappy_(compression)
- https://github.com/andikleen/snappy-c
- https://github.com/google/snappy
- https://github.com/zhipeng-jia/snappyjs
- https://web.dev/articles/loading-wasm
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

int uncompress(const char *compressed, size_t compressed_length, char *uncompressed);

// Should print "hyperparam"
// Should print "hyperparam", this is just for testing, not a real cli tool
int main() {
char compressed[] = {
0x0a, 0x24, 0x68, 0x79, 0x70, 0x65, 0x72, 0x70, 0x61, 0x72, 0x61, 0x6d
Expand Down

0 comments on commit bcab9b3

Please sign in to comment.