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

Allow retrieving the decompressed size #20

Open
feliwir opened this issue Feb 28, 2023 · 1 comment
Open

Allow retrieving the decompressed size #20

feliwir opened this issue Feb 28, 2023 · 1 comment

Comments

@feliwir
Copy link

feliwir commented Feb 28, 2023

It would be great to have a replacement function to calculate the uncompressed size. Usually people do something like that:

  bxz::ifstream is(filename, std::ios::binary);
  is.seekg (0, std::ios::end);
  length = UInt(is.tellg());
  is.seekg (0, std::ios::beg);

However with bxzstr seeking from end is not supported. However the decompressed size can be retrieved with ZSTD_getFrameContentSize for example (when using ZStd).
Are there any plans to add such a function

@tmaklin
Copy link
Owner

tmaklin commented Feb 28, 2023

For zlib, libbz2, and liblzma calculating the uncompressed size isn't typically (as far as I know) possible without decompressing the file hence the decision not to support reading from end. I can have a look at the zstd function and see if it would be feasible to add for zstd compressed files, thanks for pointing it out!

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

No branches or pull requests

2 participants