Documentation ¶
Index ¶
- type ExtractionOptions
- type FS
- func (f *FS) Extract(folder string) error
- func (f *FS) ExtractWithOptions(folder string, op *ExtractionOptions) error
- func (f *FS) File() *File
- func (f *FS) Glob(pattern string) (out []string, err error)
- func (f *FS) Open(name string) (fs.File, error)
- func (f *FS) ReadDir(name string) ([]fs.DirEntry, error)
- func (f *FS) ReadFile(name string) (out []byte, err error)
- func (f *FS) Stat(name string) (fs.FileInfo, error)
- func (f *FS) Sub(dir string) (fs.FS, error)
- type File
- func (f *File) Close() error
- func (f *File) Extract(folder string) error
- func (f *File) ExtractWithOptions(path string, op *ExtractionOptions) error
- func (f *File) FS() (*FS, error)
- func (f *File) GetSymlinkFile() fs.File
- func (f *File) IsDir() bool
- func (f *File) IsRegular() bool
- func (f *File) IsSymlink() bool
- func (f *File) Mode() fs.FileMode
- func (f *File) Read(b []byte) (int, error)
- func (f *File) ReadDir(n int) ([]fs.DirEntry, error)
- func (f *File) Stat() (fs.FileInfo, error)
- func (f *File) SymlinkPath() string
- func (f *File) WriteTo(w io.Writer) (int64, error)
- type Reader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExtractionOptions ¶ added in v0.4.0
type ExtractionOptions struct { LogOutput io.Writer //Where the verbose log should write. DereferenceSymlink bool //Replace symlinks with the target file. UnbreakSymlink bool //Try to make sure symlinks remain unbroken when extracted, without changing the symlink. Verbose bool //Prints extra info to log on an error. IgnorePerm bool //Ignore file's permissions and instead use Perm. Perm fs.FileMode //Permission to use when IgnorePerm. Defaults to 0777. SimultaneousFiles uint16 //Number of files to process in parallel. Default set based on runtime.NumCPU(). ExtractionRoutines uint16 //Number of goroutines to use for each file's extraction. Only applies to regular files. Default set based on runtime.NumCPU(). // contains filtered or unexported fields }
func DefaultOptions ¶ added in v0.4.0
func DefaultOptions() *ExtractionOptions
The default extraction options.
func FastOptions ¶ added in v1.0.0
func FastOptions() *ExtractionOptions
Less limited default options. Can run up 2x faster than DefaultOptions. Tends to use all available CPU resources.
type FS ¶ added in v0.4.0
type FS struct {
// contains filtered or unexported fields
}
FS is a fs.FS representation of a squashfs directory. Implements fs.GlobFS, fs.ReadDirFS, fs.ReadFileFS, fs.StatFS, and fs.SubFS
func (*FS) Extract ¶ added in v1.0.0
Extract the FS to the given folder. If the file is a folder, the folder's contents will be extracted to the folder. Uses default extraction options.
func (*FS) ExtractWithOptions ¶ added in v0.4.0
func (f *FS) ExtractWithOptions(folder string, op *ExtractionOptions) error
Extract the FS to the given folder. If the file is a folder, the folder's contents will be extracted to the folder. Allows setting various extraction options via ExtractionOptions.
func (*FS) Glob ¶ added in v0.4.0
Glob returns the name of the files at the given pattern. All paths are relative to the FS. Uses filepath.Match to compare names.
func (*FS) ReadDir ¶ added in v0.4.0
Returns all DirEntry's for the directory at name. If name is not a directory, returns an error.
type File ¶ added in v0.2.0
type File struct {
// contains filtered or unexported fields
}
File represents a file inside a squashfs archive.
func (*File) Close ¶ added in v0.2.0
Closes the underlying readers. Further calls to Read and WriteTo will re-create the readers. Never returns an error.
func (*File) Extract ¶ added in v1.0.0
Extract the file to the given folder. If the file is a folder, the folder's contents will be extracted to the folder. Uses default extraction options.
func (*File) ExtractWithOptions ¶ added in v0.3.0
func (f *File) ExtractWithOptions(path string, op *ExtractionOptions) error
Extract the file to the given folder. If the file is a folder, the folder's contents will be extracted to the folder. Allows setting various extraction options via ExtractionOptions.
func (*File) GetSymlinkFile ¶ added in v0.2.1
Returns the file the symlink points to. If the file isn't a symlink, or points to a file outside the archive, returns nil.
func (*File) Read ¶ added in v0.2.0
Read reads the data from the file. Only works if file is a normal file.
func (*File) ReadDir ¶ added in v0.4.0
ReadDir returns n fs.DirEntry's that's contained in the File (if it's a directory). If n <= 0 all fs.DirEntry's are returned.
func (*File) SymlinkPath ¶ added in v0.2.1
SymlinkPath returns the symlink's target path. Is the File isn't a symlink, returns an empty string.
type Reader ¶
type Reader struct { *FS Low squashfslow.Reader }
func NewReaderAtOffset ¶ added in v0.7.2
func (*Reader) FSFromDirectory ¶ added in v1.0.0
func (r *Reader) FSFromDirectory(d squashfslow.Directory, parent *FS) *FS
Creates a new *FS from the given squashfs.directory
func (*Reader) FileFromBase ¶ added in v1.0.0
func (r *Reader) FileFromBase(b squashfslow.FileBase, parent *FS) *File
Creates a new *File from the given *squashfs.Base