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

archive/zip: expose fileListEntry.file via Sys #48084

Open
colin-sitehost opened this issue Aug 31, 2021 · 1 comment
Open

archive/zip: expose fileListEntry.file via Sys #48084

colin-sitehost opened this issue Aug 31, 2021 · 1 comment
Labels
FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@colin-sitehost
Copy link

colin-sitehost commented Aug 31, 2021

Currently, when fs.WalkDiring over a Reader there is not a good way to get the zip.File from fs.DirEntry. This does not really matter for files containing data, but currently I need to interact with directory files, specifically detect if a directory exists in the archive. Because of the virtual entries that this package adds, one must iterate over Reader.File to see if the current dfs.DirEntry exists in the zip. As such, I am left to double iterate, once with fs.WalkDir and once through Reader.File, or not use fs.WalkDir and hit Reader.File directly.

It would be nice to have zip.fileListEntry.Sys return fileListEntry.file, already an exported type zip.File, to easier interact with the underlying data, especially in my case.

package zip // import "archive/zip"

func (f *fileListEntry) Sys() interface{} { return f.file }

If one is to trust the implementation will never change, you could also abuse fileListEntry.ModTime() == time.Time{}, but this seems like a bad idea.

@cherrymui cherrymui added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. FeatureRequest labels Sep 1, 2021
@cherrymui cherrymui added this to the Backlog milestone Sep 1, 2021
@cherrymui
Copy link
Member

cc @dsnet @bradfitz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

2 participants