nberlette/lz4-wasm

[request] document that the apis are "size prepended", and use "block mode"

Open

#15 opened on Nov 4, 2025

 (2 comments) (2 reactions) (2 assignees)TypeScript (0 forks)auto 404
docsgood first issuehelp wantedknown issuerusttodo

Repository metrics

Stars
 (5 stars)
PR merge metrics
 (PR metrics pending)

Description

Is your feature request related to a problem? Please describe. The Rust APIs that you are using either return or need the first 4 bytes to be the uncompressed size in little endian.

I'm new to lz4, so I don't know if that is common or not, but I don't think it is.

It's probably good to mention that these apis operate in block mode and not frame mode. The lib you use does support frame mode but not in nostd mode. https://docs.rs/lz4_flex/latest/lz4_flex/frame/index.html

I don't need frame mode for my use case anyway. It's just a point of confusion, at least for me. the lz4 command line utility seems to only operate in either regular frame mode or a "legacy" frame mode, but not in block mode.

My use case was is only decompression and it's a pre-existing video game asset, so I didn't know ahead of time if it was framed or not. (Even what framed was at first! But that's fine, I like learning.)

Before using your library, I used ImHex to explore the file and it's lz4 decompression function is documented here: https://docs.werwolv.net/pattern-language/libraries/hex/dec.pat#hex-dec-lz4_decompress

(Which is getting off topic, and their docs don't explain it that well either, but they do not expect the uncompressed size to be prepended. And I thought comparing would help you figure out what needs to be said in the docs.)

Describe the solution you'd like Improved documentation. Mention the non-standard-ish prepended size, and that frame mode is a thing but not in this lib, only block mode.

Describe alternatives you've considered Do nothing?

Additional context Add any other context or screenshots about the feature request here.

Contributor guide