Documentation
¶
Overview ¶
Package iso9660 provides parsing for ISO9660 disc images.
Index ¶
- Constants
- Variables
- func IsCueFile(path string) bool
- type CueSheet
- type FileInfo
- type ISO9660
- func (iso *ISO9660) BlockSize() int
- func (iso *ISO9660) Close() error
- func (iso *ISO9660) FileExists(path string) bool
- func (iso *ISO9660) GetDataPreparerID() string
- func (iso *ISO9660) GetPublisherID() string
- func (iso *ISO9660) GetSystemID() string
- func (iso *ISO9660) GetUUID() string
- func (iso *ISO9660) GetVolumeID() string
- func (iso *ISO9660) IterFiles(onlyRootDir bool) ([]FileInfo, error)
- func (iso *ISO9660) ReadFile(info FileInfo) ([]byte, error)
- func (iso *ISO9660) ReadFileByPath(path string) ([]byte, error)
- func (iso *ISO9660) ReadFileWithLimit(info FileInfo, maxSize uint32) ([]byte, error)
- func (iso *ISO9660) Size() int64
- func (iso *ISO9660) WalkFiles(onlyRootDir bool, fn func(FileInfo) bool) error
- type MountedDisc
- func (*MountedDisc) Close() error
- func (m *MountedDisc) FileExists(path string) bool
- func (*MountedDisc) GetDataPreparerID() string
- func (*MountedDisc) GetPublisherID() string
- func (*MountedDisc) GetSystemID() string
- func (m *MountedDisc) GetUUID() string
- func (m *MountedDisc) GetVolumeID() string
- func (m *MountedDisc) IterFiles(onlyRootDir bool) ([]FileInfo, error)
- func (m *MountedDisc) ReadFile(info FileInfo) ([]byte, error)
- func (m *MountedDisc) ReadFileByPath(path string) ([]byte, error)
Constants ¶
const DefaultReadFileSizeLimit uint32 = 16 * 1024 * 1024
DefaultReadFileSizeLimit caps ReadFile allocations. Directory records store sizes as uint32, so corrupt images can claim up to 4GB for a file.
Variables ¶
var ( ErrInvalidISO = errors.New("invalid ISO9660 image") ErrPVDNotFound = errors.New("primary volume descriptor not found") ErrInvalidBlock = errors.New("invalid block size") ErrFileNotFound = errors.New("file not found") )
Common errors
Functions ¶
Types ¶
type CueSheet ¶
type CueSheet struct {
Path string // Path to the CUE file
BinFiles []string // Paths to BIN files (absolute)
}
CueSheet represents a parsed CUE sheet file.
type ISO9660 ¶
type ISO9660 struct {
// contains filtered or unexported fields
}
ISO9660 represents a parsed ISO9660 disc image.
func OpenCHD ¶
OpenCHD opens an ISO9660 filesystem from a CHD disc image file. The CHD file's DataTrackSectorReader provides 2048-byte logical sectors starting at the first data track, suitable for ISO9660 parsing. This handles multi-track CDs like Neo Geo CD that have audio tracks first.
func OpenCue ¶
OpenCue opens an ISO9660 disc image from a CUE sheet. It uses the first BIN file referenced in the CUE sheet.
func OpenReader ¶
OpenReader creates an ISO9660 from an io.ReaderAt. The caller is responsible for closing the underlying reader if needed.
func OpenReaderWithCloser ¶
OpenReaderWithCloser creates an ISO9660 from an io.ReaderAt with an optional closer. The closer will be called when Close() is called on the ISO9660.
func (*ISO9660) FileExists ¶
FileExists checks if a file exists at the given path.
func (*ISO9660) GetDataPreparerID ¶
GetDataPreparerID returns the data preparer identifier from the PVD.
func (*ISO9660) GetPublisherID ¶
GetPublisherID returns the publisher identifier from the PVD.
func (*ISO9660) GetSystemID ¶
GetSystemID returns the system identifier from the PVD.
func (*ISO9660) GetVolumeID ¶
GetVolumeID returns the volume identifier from the PVD.
func (*ISO9660) IterFiles ¶
IterFiles returns a list of files in the filesystem. If onlyRootDir is true, only files in the root directory are returned.
func (*ISO9660) ReadFileByPath ¶
ReadFileByPath reads a file by its path.
func (*ISO9660) ReadFileWithLimit ¶
ReadFileWithLimit reads the contents of a file with a caller-provided size limit. A limit of 0 disables the guard.
type MountedDisc ¶
type MountedDisc struct {
// contains filtered or unexported fields
}
MountedDisc represents a mounted disc directory. This allows treating a directory as if it were an ISO9660 filesystem.
func OpenMounted ¶
func OpenMounted(path, uuid, volumeID string) (*MountedDisc, error)
OpenMounted creates a MountedDisc from a directory path.
func (*MountedDisc) FileExists ¶
func (m *MountedDisc) FileExists(path string) bool
FileExists checks if a file exists at the given path.
func (*MountedDisc) GetDataPreparerID ¶
func (*MountedDisc) GetDataPreparerID() string
GetDataPreparerID returns empty string for mounted discs.
func (*MountedDisc) GetPublisherID ¶
func (*MountedDisc) GetPublisherID() string
GetPublisherID returns empty string for mounted discs.
func (*MountedDisc) GetSystemID ¶
func (*MountedDisc) GetSystemID() string
GetSystemID returns empty string for mounted discs.
func (*MountedDisc) GetUUID ¶
func (m *MountedDisc) GetUUID() string
GetUUID returns the UUID if set.
func (*MountedDisc) GetVolumeID ¶
func (m *MountedDisc) GetVolumeID() string
GetVolumeID returns the volume ID.
func (*MountedDisc) IterFiles ¶
func (m *MountedDisc) IterFiles(onlyRootDir bool) ([]FileInfo, error)
IterFiles returns a list of files in the mounted directory.
func (*MountedDisc) ReadFile ¶
func (m *MountedDisc) ReadFile(info FileInfo) ([]byte, error)
ReadFile reads a file from the mounted directory.
func (*MountedDisc) ReadFileByPath ¶
func (m *MountedDisc) ReadFileByPath(path string) ([]byte, error)
ReadFileByPath reads a file by its path.