Documentation ¶
Overview ¶
Package archivefs allows the traversal of a filetree and treating archive files transparently.
Supported archive formats is currently limited to zip.
Index ¶
- Variables
- func Open(filename string) (io.ReadSeeker, int, error)
- func RemoveArchiveExt(s string) string
- func TrimArchiveExt(s string) string
- type Node
- type Path
- func (afs Path) Base() string
- func (afs *Path) Close()
- func (afs Path) Dir() string
- func (afs Path) InArchive() bool
- func (afs Path) IsDir() bool
- func (afs *Path) List() ([]Node, error)
- func (afs Path) Open() (io.ReadSeeker, int, error)
- func (afs *Path) Set(path string) error
- func (afs Path) String() string
Constants ¶
This section is empty.
Variables ¶
var ArchiveExtensions = [...]string{".ZIP"}
list of file extensions for the supported archive types
Functions ¶
func Open ¶
func Open(filename string) (io.ReadSeeker, int, error)
Open and return an io.ReadSeeker for the specified filename. Filename can be inside an archive supported by archivefs
Returns the io.ReadSeeker, the size of the data behind the ReadSeeker and any errors.
func RemoveArchiveExt ¶
RemoveArchiveExt removes the file extension of any supported/recognised archive type from within the string. Only the first instance of the extension is removed
func TrimArchiveExt ¶
TrimArchiveExt removes the file extension of any supported/recognised archive type from the end of the string
Types ¶
type Node ¶
type Node struct { Name string // a directory has the the field of IsDir set to true IsDir bool // a recognised archive file has InArchive set to true. note that an archive // file is also considered to be directory IsArchive bool }
Node represents a single part of a full path
type Path ¶
type Path struct {
// contains filtered or unexported fields
}
Path represents a single destination in the file system
func (Path) IsDir ¶
IsDir returns true if Path is currently set to a directory. For the purposes of archivefs, the root of an archive is treated as a directory
func (*Path) List ¶
List returns the child entries for the current path location. If the current path is a file then the list will be the contents of the containing directory of that file