-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: archive/tar: implement fs.FS #61232
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
Comments
I don't think this is feasible with the current API and without in memory buffering: |
I think we can manage that by checking to see if the |
I think even if the given reader did also implement It would be possible in principle to make a separate type that wraps an Do you have some specific ideas for how it would be implemented? If the proposal is to redesign Based on experience with other proposals, I think you'd then also need to demonstrate that there's some benefit to it being in standard library rather than just remaining as a separate library maintained in your own repository. |
tar (Tape ARchive) is a streaming format. It's fundamentally unsuited for random access. You could build a random access reader, of course, but you'd be fighting the format and it would be a completely different implementation than If you want random access within an archive, you're better off using zip, which is designed for the purpose. |
It looks like the zip format affords a "central directory" at the end of the file. The first call of Tar archives frequently appear as |
An alternative is to make a new constructor to allow for a more self-contained implementation and stronger distinction from the existing package tar
func FS(r io.ReaderAt, size int64) (fs.FS, error) |
An entirely new implementation that requires an FWIW in my experience when I've used |
there are existing implementations, neither of which seem popular enough to be worth adding into the standard library https://pkg.go.dev/github.com/nlepage/go-tarfs |
Thanks - closing this out. |
This proposal has been declined as retracted. |
archive/tar.Reader
should implementfs.FS
which puts it on par witharchive/zip.Reader
and it enables the tarball to be accessed through thefs.FS
interface without requiring an intermediate step of inflating the tarball out to the filesystem.The text was updated successfully, but these errors were encountered: