Documentation ¶
Overview ¶
Print the names and contents of the files in a tar or zip archive. Only makes sense for archives containing only text files.
The archive/tar API doesn't presume random access, and I can't figure out how I could present a facade for tars and zips that gives random access to individual files in the archive without using syscall.Dup or opening a bunch of file descriptors that could possibly be to different files if the filesystem changed. I started out with a program that just detected and printed archive types, which seemed to satisfy most of the spirit of the exercise, but I decided to go a bit further and print file contents. Wrapping an io.Reader like in zip/zip.go and tar/tar.go is awkward and not that useful, since it basically assumes none of the files are binary.