Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Disc ¶
type Disc struct {
// contains filtered or unexported fields
}
Disc represents an attached ISO image. Obtain one via Attach; release resources with Detach.
func Attach ¶
Attach opens an ISO image file and probes it for recognised filesystem layers. The file handle is held open until Detach is called.
disc, err := diskiso.Attach("windows-arm64.iso")
func (*Disc) Detach ¶
Detach closes the underlying image file and releases all resources. Calling Detach on an already-detached Disc is a no-op.
func (*Disc) FilesystemNames ¶
FilesystemNames returns the same list as human-readable strings.
disc.FilesystemNames() // → ["udf", "joliet", "iso9660"]
func (*Disc) Filesystems ¶
func (d *Disc) Filesystems() []Filesystem
Filesystems returns the detected layers in descending priority order. The first entry is what Mount selects automatically.
disc.Filesystems() // → [UDF Joliet ISO9660]
func (*Disc) Mount ¶
func (d *Disc) Mount(want ...Filesystem) (Volume, error)
Mount returns a read-only Volume backed by the requested filesystem layer. With no argument the best available layer is chosen automatically: UDF > Joliet > RockRidge > ISO9660.
vol, err := disc.Mount() // auto-pick vol, err := disc.Mount(diskiso.UDF) // explicit vol, err := disc.Mount(diskiso.Joliet) // fallback
type Filesystem ¶
type Filesystem int
Filesystem identifies a filesystem layer present within an ISO image. A single .iso typically carries several overlapping layers (e.g. ISO9660 + Joliet + UDF) that all reference the same underlying data.
const ( // ISO9660 is the base ECMA-119 layer. Uppercase ASCII names, 8.3 or 31 chars. // Always present for compatibility. ISO9660 Filesystem = iota // Joliet is Microsoft's Unicode extension. UCS-2BE names up to 64 chars. // Stored in a Supplementary Volume Descriptor. Joliet // RockRidge adds POSIX semantics: long mixed-case names, symlinks, permissions. // Stored in the System Use fields of ISO9660 directory records. RockRidge // UDF is Universal Disk Format (ECMA-167). The modern standard used by DVDs, // Windows ISOs, and Linux-generated images. UDF )
func (Filesystem) String ¶
func (f Filesystem) String() string
type Volume ¶
type Volume interface {
// Type returns the layer name: "iso9660", "joliet", "rockridge", or "udf".
Type() string
// Label returns the volume label embedded in the image.
Label() string
// ReadFile reads the entire contents of a file.
ReadFile(path string) ([]byte, error)
// Open opens a file for streaming. The caller must Close it.
Open(path string) (fs.File, error)
// ReadDir lists the entries in a directory.
ReadDir(path string) ([]fs.DirEntry, error)
// Stat returns metadata for a path.
Stat(path string) (os.FileInfo, error)
// Readlink returns the symlink target. Only meaningful on RockRidge volumes;
// all others return an error.
Readlink(path string) (string, error)
}
Volume is a read-only view into a single filesystem layer of an ISO image. All paths are absolute (e.g. "/sources/install.wim").
Obtain a Volume via Disc.Mount; it is valid for the lifetime of the Disc.