codedread / bitjs

Binary Tools for JavaScript
MIT License
81 stars 7 forks source link

Is there any support on extracting a specific file. #12

Closed kanoonsantikul closed 6 years ago

kanoonsantikul commented 6 years ago

Some tool such as WinRAR have ability to access list of files and specify what files to decompress. I wonder if it is possible to retrieve file list information in archive file.

codedread commented 6 years ago

Can you describe more exactly what you're looking for? Is it that you want to list the files, then specify only a certain file to be extracted? Is it because you believe this will be faster?

If we supported this, it would be only slightly faster since the entire file has to be parsed first to figure out the contents.

kanoonsantikul commented 6 years ago

I have store cbr files in Google Drive. I want to read first file name in archive and extract it before entire has been loaded to use it as thumbnail of that file.

codedread commented 6 years ago

As far as I can tell, there's no way to do this, you need to seek through the entire archive bytes to learn of the files inside the archive.

FWIW, I recently updated the library to unarchive progressively as the file is downloaded. If you can guarantee the first file in the archive is always your thumbnail, it could be done.