ZIPFoundation icon indicating copy to clipboard operation
ZIPFoundation copied to clipboard

Support to get index & count of entries in Archive

Open ductranit opened this issue 5 years ago • 1 comments

I have a zip with multiple entries, I want to check to make sure this zip is totally decompress by compare its entries count and the total files in decompress directory. But Archive doesn't support to get count without loading all of entries.

At this time I have to load all entries to the sorted list to only get the files count like this:

 let sortedEntries = archive.sorted(by: { $0.path < $1.path })
 let count = sortedEntries.count
 if count == destinationDirFiles.count {
      // the uncompress process is done
}

But the problem is that it's very slow because I have about 25k entries in the zip. Could you please add the count into Archive when loading it? And I'd be great if you can support to access entry by index along with the Sequence

ductranit avatar Jun 12 '19 09:06 ductranit

don't know if this will help but you can use archive.reversed() to get the entery I think it is faster than sorting method

musa-almatri avatar Feb 17 '20 06:02 musa-almatri