nika-begiashvili / libarchivejs

Archive library for browsers
MIT License
288 stars 35 forks source link

Way to extract just one file from an archive? #1

Closed TranquilMarmot closed 5 years ago

TranquilMarmot commented 5 years ago

You can call getFilesObject and getFilesArray to get a list of all of the files in an archive, but it seems like the only option to extract any files is to call extractFiles which extracts all of the files.

Would it be possible to add a way to only extract one of the files in the array?

nika-begiashvili commented 5 years ago

Yes! I was actually planning this, my idea is for getFilesObject and getFilesArray to return CompressedFile objects ( unless you run extractFiles() ) which would have extract() method on it, what do you think about that kind of API ?

TranquilMarmot commented 5 years ago

That sounds great! My use case is to basically stream in one file at a time (i.e. paging through images in a zip) so that would work awesome.

nika-begiashvili commented 5 years ago

do you mind trying it out before I merge it ? https://github.com/nika-begiashvili/libarchivejs/tree/single-file-extract

nika-begiashvili commented 5 years ago

4

nika-begiashvili commented 5 years ago

Released as v1.1.0