Documentation
¶
Overview ¶
Package far implements Fuchsia archive operations. At this time only archive writing is supported. The specification for the archive format can be found in https://fuchsia.dev/fuchsia-src/concepts/storage/archive_format
Index ¶
Constants ¶
const DirectoryEntryLen = 4 + 2 + 2 + 8 + 8 + 8
DirectoryEntryLen is the byte size of the DirectoryEntry struct
const IndexEntryLen = 8 + 8 + 8
IndexEntryLen is the byte size of the IndexEntry struct
const IndexLen = 8 + 8
IndexLen is the byte size of the Index struct
const Magic = "\xc8\xbf\x0b\x48\xad\xab\xc5\x11"
Magic is the first bytes of a FAR archive
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ChunkType ¶
type ChunkType uint64
ChunkType is a uint64 representing the type of a non-index chunk
type DirectoryEntry ¶
type DirectoryEntry struct { NameOffset uint32 NameLength uint16 Reserved uint16 DataOffset uint64 DataLength uint64 Reserved2 uint64 }
DirectoryEntry indexes into the dirnames and contents chunks to provide access to file names and file contents respectively.
type EntryReader ¶
type EntryReader struct { // Offset of this entry from the start of the archive Offset uint64 // Length of this entry in the archive Length uint64 Source io.ReaderAt }
EntryReader allows reading the contents of an archive entry, file or directory.
type ErrInvalidArchive ¶
type ErrInvalidArchive string
ErrInvalidArchive is returned from reads when the archive is not of the expected format or is corrupted.
func (ErrInvalidArchive) Error ¶
func (e ErrInvalidArchive) Error() string
type Index ¶
type Index struct { // Magic bytes must equal the Magic constant Magic [8]byte // Length of all index entries in bytes Length uint64 }
Index is the first chunk of an archive
type IndexEntry ¶
type IndexEntry struct { // Type of the chunk Type ChunkType // Offset from the start of the archive Offset uint64 // Length of the chunk Length uint64 }
IndexEntry identifies the type and position of a chunk in the archive
type PathData ¶
type PathData []byte
PathData is a concatenated list of names of files that makes up the unpadded portion of a dirnames chunk.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader wraps an io.ReaderAt providing access to FAR contents from that io. It caches the directory and path information after it is read, and provides io.Readers for files contained in the archive.
func NewReader ¶
NewReader wraps the given io.ReaderAt and returns a struct that provides indexed access to the FAR contents.