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

Support to get index & count of entries in Archive #129

Open
ductranit opened this issue Jun 12, 2019 · 1 comment
Open

Support to get index & count of entries in Archive #129

ductranit opened this issue Jun 12, 2019 · 1 comment

Comments

@ductranit
Copy link

ductranit commented Jun 12, 2019

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

@musa-almatri
Copy link

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

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

No branches or pull requests

2 participants