Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing size to decompress() API #223

Open
jtbandes opened this issue Feb 12, 2022 · 1 comment
Open

Passing size to decompress() API #223

jtbandes opened this issue Feb 12, 2022 · 1 comment

Comments

@jtbandes
Copy link

jtbandes commented Feb 12, 2022

When streaming compression is used, the compressed frame does not include a size, and therefore ZSTD_getFrameContentSize will return ZSTD_CONTENTSIZE_UNKNOWN. Thus, the new Simple().decompress(buf) call will fail, because contentSizeImpl returns null.

However, if the caller already knows the decompressed size (by some other means), it should still be possible to use the new Simple().decompress() function. This could be achieved by passing an optional size param to the function.

Edit: I have worked around the issue by using the streaming decompress function. However I still think it would be valuable for the simple decompress function to include an optional size param.

@jhurliman
Copy link

For anyone that needs this functionality, the https://github.com/foxglove/wasm-zstd library supports decompressing with a known (or upper bound) decompressed data size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants