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

Inflate: write to provided buffer #147

Open
nickbabcock opened this issue Nov 10, 2023 · 2 comments
Open

Inflate: write to provided buffer #147

nickbabcock opened this issue Nov 10, 2023 · 2 comments

Comments

@nickbabcock
Copy link

nickbabcock commented Nov 10, 2023

I'm interested in adapting zune-inflate for my purposes: concatenating multiple deflated pieces of data into a single buffer (imagine a zip file that has several files that can should be seen as one)

Right now, zune-inflate will issue a new buffer per request that then needs to be copied to the concatenated buffer.

Do you see a future where zune-inflate writes to a provided buffer? I can provide a buffer that has the required space + necessary padding.

For context, I'm in an environment where memory allocations are slower (Wasm), so I'm interested in avoiding them where possible.

EDIT: removed irrelevant discussion if provided API is implemented.

@etemesi254
Copy link
Owner

Hi, yes, I do strive to provide an api that can writes to a pre-allocated buffer, but the problem is with inflate, we can't know how much space is needed to fully decompress given compressed data as the format doesn't have a size field or anything like that , unless you frame your data and explicitly provide size.

The alternative is that we always check if we can write to a provided buffer and if not we signal an error but suspension and recoverability complicates the api a lot so I'm not sure that's a worthwhile road to follow, but open to ideas

@wcampbell0x2a
Copy link

I use zune-inflate for backhand in which I already know the size of the uncompressed bytes and would use this feature if added!

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

3 participants