Seeking / streaming from compressed files

Started by
12 comments, last by Nagle 1 year, 9 months ago

Nagle said:

Juliean said:

I'm 99% certain that this can't be done.

Sure it can. See https://libzip.org/documentation/libzip.html

There are several libraries for reading and writing ZIP files. Reading is cheap. You can look up a file within the ZIP file by pathname, then start reading it without decompressing the whole archive. For this application, read-only mode is all you need.

You are right but as I said: I do not want to compress the whole file….but the other answers explain how this can be achieved so all good!

Advertisement

Nagle said:

Juliean said:

I'm 99% certain that this can't be done.

Sure it can. See https://libzip.org/documentation/libzip.html

There are several libraries for reading and writing ZIP files. Reading is cheap. You can look up a file within the ZIP file by pathname, then start reading it without decompressing the whole archive. For this application, read-only mode is all you need.

Yes, but this is only achieved in an archive-format by compressing multiple files separately and using a header with the file-location information. Pretty much what I described in my second answer. What you cannot do is just compress files into a blob and except to be able to selectively decompress that selectively.

Juliean said:
What you cannot do is just compress files into a blob and except to be able to selectively decompress that selectively.

Depends on the format. Files within ZIP files are individually decompressable. Files within GZIP files are individually decompressable. Files within ZLIB are individually decompressable. That covers most of the mainstream compressed formats.

This topic is closed to new replies.

Advertisement