-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
First of all, congratulations and thanks for this library.
As far as I know, 7zip uses an index, like zip files.
Going through the code, we can see that we are loading all entries when we initialize the 7zip reader, so when we call Next(), we are just iterating through a slice to get the FileInfo:
Lines 188 to 197 in 9c09b6b
| func (sz *Reader) nextFileInfo() *headers.FileInfo { | |
| var fileInfo *headers.FileInfo | |
| if sz.fileIndex < len(sz.header.FilesInfo) { | |
| fileInfo = sz.header.FilesInfo[sz.fileIndex] | |
| sz.fileIndex++ | |
| return fileInfo | |
| } | |
| return nil | |
| } |
My question is, why do we need an iterator-like API if we know the entries beforehand? Maybe an archive/zip API would be better for this use case?:
zr, _ := go7z.NewReader(readerAt, size)
for _, f := range zr.Files {
info := f.FileInfo()
name := f.Name
reader, _ := f.Open()
...
}Sorry in advance if I missed some obvious problem here that makes this impossible. If you think it's a good idea, I'll be happy to help with the implementation.
Metadata
Metadata
Assignees
Labels
No labels