Skip to content

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

Description

@colin-sitehost

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions