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 AsyncPath
- type AsyncResults
- type FilenameSetter
- 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 AsyncPath ¶ added in v0.30.1
type AsyncPath struct {
Set chan string
Close chan bool
Destroy chan bool
// Results of most recent change of path settings
Results AsyncResults
// contains filtered or unexported fields
}
AsyncPath provides asynchronous access to an archivefs
func NewAsyncPath ¶ added in v0.30.1
func NewAsyncPath(setter FilenameSetter) AsyncPath
NewAsyncPath is the preferred method of initialisation for the AsyncPath type
type AsyncResults ¶ added in v0.30.1
AsyncResults are copies of archivefs path information that are safe to access asynchronously
type FilenameSetter ¶ added in v0.30.1
type FilenameSetter interface {
SetSelectedFilename(string)
}
SetSelectedFilename is called after a successful Set()
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