Documentation ¶
Index ¶
- Constants
- Variables
- type ExtractionOptions
- type FS
- 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) ([]byte, 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) ExtractSymlink(folder string) error
- func (f File) ExtractTo(folder string) error
- func (f File) ExtractWithOptions(folder string, op ExtractionOptions) error
- func (f *File) FS() (*FS, error)
- func (f File) GetSymlinkFile() *File
- func (f File) IsDir() bool
- func (f File) IsRegular() bool
- func (f File) IsSymlink() bool
- func (f File) Read(p []byte) (int, error)
- func (f *File) ReadDir(n int) (out []fs.DirEntry, err 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 ¶
const ( GZipCompression = uint16(iota + 1) LZMACompression LZOCompression XZCompression LZ4Compression ZSTDCompression )
The types of compression supported by squashfs
Variables ¶
var ( ErrorMagic = errors.New("magic incorrect. probably not reading squashfs archive") ErrorLog = errors.New("block log is incorrect. possible corrupted archive") ErrorVersion = errors.New("squashfs version of archive is not 4.0") )
var (
ErrReadNotFile = errors.New("read called on non-file")
)
Functions ¶
This section is empty.
Types ¶
type ExtractionOptions ¶ added in v0.4.0
type ExtractionOptions struct { LogOutput io.Writer //Where error log should write. If nil, uses os.Stdout. Has no effect if verbose is false. 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 FolderPerm fs.FileMode //The permissions used when creating the extraction folder }
ExtractionOptions are available options on how to extract.
func DefaultOptions ¶ added in v0.4.0
func DefaultOptions() ExtractionOptions
DefaultOptions is the default ExtractionOptions.
type FS ¶ added in v0.4.0
type FS struct { *File // 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) 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
ReadDir returns all the DirEntry 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
Close simply nils the underlying reader. Here mostly to satisfy fs.File
func (File) ExtractSymlink ¶ added in v0.3.1
ExtractSymlink extracts the File to the folder with the DereferenceSymlink option. If the File is a directory, it instead extracts the directory's contents to the folder.
func (File) ExtractTo ¶ added in v0.3.0
ExtractTo extracts the File to the given folder with the default options. If the File is a directory, it instead extracts the directory's contents to the folder.
func (File) ExtractWithOptions ¶ added in v0.3.0
func (f File) ExtractWithOptions(folder string, op ExtractionOptions) error
ExtractWithOptions extracts the File to the given folder with the given ExtrationOptions. If the File is a directory, it instead extracts the directory's contents to the folder.
func (File) GetSymlinkFile ¶ added in v0.2.1
GetSymlinkFile returns the File the symlink is pointing to. If not a symlink, or the target is unobtainable (such as it being outside the archive or it's absolute) 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 // contains filtered or unexported fields }
func NewReaderFromReader ¶ added in v0.6.0
Creates a new squashfs.Reader from the given io.Reader. NOTE: All data from the io.Reader will be read and stored in memory.