Documentation
¶
Overview ¶
Package common provides common utilities for embedded filesystem extractors.
Index ¶
- func DetectFilesystem(r io.ReaderAt, offset int64) string
- func ExtractAllRecursiveExFAT(section *io.SectionReader, dst string) error
- func ExtractAllRecursiveExt(fs *ext4.FileSystem, srcPath, destPath string) error
- func ExtractAllRecursiveFat32(fs *fat32.FileSystem, srcPath, destPath string) error
- func ExtractAllRecursiveNtfs(fs *parser.NTFSContext, srcPath, destPath string) error
- func GetDiskPartitions(tmpRawPath string) ([]part.Partition, *disk.Disk, error)
- func NewPartitionEmbeddedFSGetter(pluginName string, partitionIndex int, p part.Partition, disk *disk.Disk, ...) func(context.Context) (scalibrfs.FS, error)
- func TARToTempDir(reader io.Reader) (string, error)
- type CloserWithTmpPaths
- type EmbeddedDirFS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectFilesystem ¶
DetectFilesystem identifies the filesystem type by magic bytes.
func ExtractAllRecursiveExFAT ¶
func ExtractAllRecursiveExFAT(section *io.SectionReader, dst string) error
ExtractAllRecursiveExFAT extracts all files from an exFAT filesystem to a temporary directory recursively.
func ExtractAllRecursiveExt ¶
func ExtractAllRecursiveExt(fs *ext4.FileSystem, srcPath, destPath string) error
ExtractAllRecursiveExt extracts all files from an ext4 filesystem to a temporary directory recursively.
func ExtractAllRecursiveFat32 ¶
func ExtractAllRecursiveFat32(fs *fat32.FileSystem, srcPath, destPath string) error
ExtractAllRecursiveFat32 extracts all files from a FAT32 filesystem to a temporary directory recursively.
func ExtractAllRecursiveNtfs ¶
func ExtractAllRecursiveNtfs(fs *parser.NTFSContext, srcPath, destPath string) error
ExtractAllRecursiveNtfs extracts all files from a NTFS filesystem to a temporary directory recursively.
func GetDiskPartitions ¶
GetDiskPartitions opens a raw disk image and returns its partitions along with the disk handle.
func NewPartitionEmbeddedFSGetter ¶
func NewPartitionEmbeddedFSGetter(pluginName string, partitionIndex int, p part.Partition, disk *disk.Disk, tmpRawPath string, refMu *sync.Mutex, refCount *int32) func(context.Context) (scalibrfs.FS, error)
NewPartitionEmbeddedFSGetter creates a lazy getter function for an embedded filesystem from a disk partition.
Types ¶
type CloserWithTmpPaths ¶
CloserWithTmpPaths is an interface for filesystems that provide temporary paths for cleanup.
type EmbeddedDirFS ¶
type EmbeddedDirFS struct {
FS scalibrfs.FS
File *os.File
TmpPaths []string
RefCount *int32
RefMu *sync.Mutex
}
EmbeddedDirFS wraps scalibrfs.DirFS to include reference counting and cleanup.
func (*EmbeddedDirFS) Close ¶
func (e *EmbeddedDirFS) Close() error
Close closes the underlying file without removing temporary paths.
func (*EmbeddedDirFS) Open ¶
func (e *EmbeddedDirFS) Open(name string) (fs.File, error)
Open opens the specified file from the embedded filesystem.
func (*EmbeddedDirFS) ReadDir ¶
func (e *EmbeddedDirFS) ReadDir(name string) ([]fs.DirEntry, error)
ReadDir returns a list of directory entries for the specified path. If name is empty or "/", it reads from the root directory instead.
func (*EmbeddedDirFS) Stat ¶
func (e *EmbeddedDirFS) Stat(name string) (fs.FileInfo, error)
Stat returns a FileInfo describing the named file or directory. If the name refers to the root directory ("/", "", or "."), it returns a synthetic FileInfo representing a directory.
func (*EmbeddedDirFS) TempPaths ¶
func (e *EmbeddedDirFS) TempPaths() []string
TempPaths returns the temporary paths associated with the filesystem for cleanup.