Socket
Book a DemoInstallSign in
Socket

vimagination.zapto.org/squashfs

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vimagination.zapto.org/squashfs

Go Modules
Version
v0.0.0-20240610201128-cc4dc6e58064
Version published
Created
Source

squashfs

-- import "vimagination.zapto.org/squashfs"

Package squashfs is a SquashFS reader and writer using fs.FS

Usage

var (
	ErrInvalidCompressor            = errors.New("invalid or unknown compressor")
	ErrInvalidCompressionLevel      = errors.New("invalid compression level")
	ErrInvalidWindowSize            = errors.New("invalid window size")
	ErrInvalidCompressionStrategies = errors.New("invalid compression strategies")
	ErrNoCompressorOptions          = errors.New("no compressor options should be supplied")
	ErrInvalidCompressionAlgorithm  = errors.New("invalid compression algorithm")
	ErrInvalidDictionarySize        = errors.New("invalid dictionary size")
	ErrInvalidFilters               = errors.New("invalid filters")
	ErrInvalidCompressorVersion     = errors.New("invalid compressor version")
	ErrInvalidCompressorFlags       = errors.New("invalid compressor flags")
	ErrUnsupportedCompressor        = errors.New("unsupported compressor")

	ErrInvalidPointer     = errors.New("invalid pointer")
	ErrInvalidBlockHeader = errors.New("invalid block header")

	ErrInvalidMagicNumber = errors.New("invalid magic number")
	ErrInvalidBlockSize   = errors.New("invalid block size")
	ErrInvalidVersion     = errors.New("invalid version")
)

type Compressor

type Compressor uint16
const (
	CompressorGZIP Compressor = 1
	CompressorLZMA Compressor = 2
	CompressorLZO  Compressor = 3
	CompressorXZ   Compressor = 4
	CompressorLZ4  Compressor = 5
	CompressorZSTD Compressor = 6
)

func (Compressor) String

func (c Compressor) String() string

type CompressorOptions

type CompressorOptions interface {
	// contains filtered or unexported methods
}

type GZipOptions

type GZipOptions struct {
	CompressionLevel uint32
	WindowSize       uint16
	Strategies       uint16
}

func DefaultGzipOptions

func DefaultGzipOptions() *GZipOptions

type LZ4Options

type LZ4Options struct {
	Version uint32
	Flags   uint32
}

type LZMAOptions

type LZMAOptions struct{}

func DefaultLZMAOptions

func DefaultLZMAOptions() LZMAOptions

type LZOOptions

type LZOOptions struct {
	Algorithm        uint32
	CompressionLevel uint32
}

func DefaultLZOOptions

func DefaultLZOOptions() *LZOOptions

type SquashFS

type SquashFS struct {
}

The SquashFS type implements many of the FS interfaces, such as: fs.FS fs.ReadFileFS fs.ReadDirFS fs.StatFS

and has additional methods for dealing with symlinks.

func Open

func Open(r io.ReaderAt) (*SquashFS, error)

Open reads the passed io.ReaderAt as a SquashFS image, returning a fs.FS implementation.

The returned fs.FS, and any files opened from it will cease to work if the io.ReaderAt is closed.

func OpenWithCacheSize

func OpenWithCacheSize(r io.ReaderAt, cacheSize int) (*SquashFS, error)

OpenWithCacheSize acts like Open, but allows a custom cache size, which normally defaults to 16MB.

func (*SquashFS) LStat

func (s *SquashFS) LStat(path string) (fs.FileInfo, error)

Lstat returns a FileInfo describing the named file. If the file is a symbolic link, the returned FileInfo describes the symbolic link.

func (*SquashFS) Open

func (s *SquashFS) Open(path string) (fs.File, error)

Open opens the named file for reading.

func (*SquashFS) ReadDir

func (s *SquashFS) ReadDir(name string) ([]fs.DirEntry, error)

ReadDir returns a sorted list of directory entries for the named directory.

func (*SquashFS) ReadFile

func (s *SquashFS) ReadFile(name string) ([]byte, error)

ReadFile return the byte contents of the named file.

func (s *SquashFS) Readlink(path string) (string, error)

Readlink returns the destination of the named symbolic link.

func (*SquashFS) Stat

func (s *SquashFS) Stat(path string) (fs.FileInfo, error)

Stat returns a FileInfo describing the name file.

type Stats

type Stats struct {
	Inodes     uint32
	ModTime    time.Time
	BlockSize  uint32
	FragCount  uint32
	Compressor Compressor
	Flags      uint16
	BytesUsed  uint64
}

Type Stats contains basic data about the SquashFS file, read from the superblock.

func ReadStats

func ReadStats(r io.Reader) (*Stats, error)

ReadStats reads the superblock from the passed reader and returns useful stats.

type XZOptions

type XZOptions struct {
	DictionarySize uint32
	Filters        uint32
}

func DefaultXZOptions

func DefaultXZOptions() *XZOptions

type ZStdOptions

type ZStdOptions struct {
	CompressionLevel uint32
}

func DefaultZStdOptions

func DefaultZStdOptions() *ZStdOptions

FAQs

Package last updated on 10 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts