Documentation ¶
Index ¶
Constants ¶
const ( DirType inoType = iota + 1 FileType SymlinkType BlockDevType CharDevType FifoType SocketType XDirType XFileType XSymlinkType XBlockDevType XCharDevType XFifoType XSocketType )
Variables ¶
Functions ¶
func Open ¶
func Open(fs io.ReaderAt) (res c.Filesystem, err error)
Open returns a new instance of squashFs for a given io.ReaderAt that can be used to access files inside squashfs.
func RegisterDecompressor ¶
func RegisterDecompressor(method Compression, dcomp Decompressor)
RegisterDecompressor can be used to register a Decompressor for squashfs. GZip and ZSTD are supported by default. You can register additional decompressor types before opening squashfs archives that use them. Once registered, decompressors cannot be deregistered, only replaced.
Types ¶
type Compression ¶
type Compression uint16
Compression tracks what type of compression a squashfs is using. We support all known formats except LZO to a greater or lesser degree of efficiency. right now, zstd will be the most performant, followed by zlib. LZO is excluded due to the only Go native implementation being GPL licensed.
const ( GZip Compression = iota + 1 // GZip is compatible with darn near everything, but is neither the fastest or smallest compression. LZMA // LZMA decompressors are bloated and slow, avoid. LZO // LZO is not available due to GPL entanglements. XZ // XZ has good compression, but it isnt the fastest decompression around. LZ4 // LZ4 has fast decompression, but is by far the least space efficient. ZSTD // ZSTD has excellent decompression speed and good compression ratios. )
func (Compression) String ¶
func (s Compression) String() string
type Decompressor ¶
Decompressor takes an input buffer and a destination buffer and returns the destination buffer filled with data and an error It matches the function signature of github.com/klauspost/compress/zstd Reader.DecodeAll. The library internals will eventually leverage it to optimize buffer reuse and caching.
func MakeDecompressor ¶
func MakeDecompressor(dec func(r io.Reader) io.Reader) Decompressor
func MakeDecompressorErr ¶
MakeDecompressorErr is similar to MakeDecompressor but the factory method also returns an error.
Example use: * squashfs.RegisterDecompressor(squashfs.LZMA, squashfs.MakeDecompressorErr(lzma.NewReader)) * squashfs.RegisterDecompressor(squashfs.XZ, squashfs.MakeDecompressorErr(xz.NewReader))