Documentation
¶
Overview ¶
Package compress decompresses a package member into a random-access io.ReaderAt.
The container readers in this module need random access over an io.ReaderAt, but the compressed inner members of a package are sequential streams. Decompress expands such a member to a temporary file once and serves it back as a *File, which is an io.ReaderAt whose File.Close removes the backing file. This is uniform across every codec, avoiding per-codec seekability handling. An uncompressed member is passed through directly — no copy and no temporary file.
The gzip and bzip2 codecs come from the standard library; xz and lzma are provided by github.com/ulikunitz/xz and zstd by github.com/klauspost/compress/zstd.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is the decompressed content of a package member exposed as a random-access io.ReaderAt. Compressed members are backed by a temporary file that File.Close removes; an uncompressed member is served directly from the source, in which case File.Close is a no-op.
func Decompress ¶
Decompress detects the codec of the size-byte member ra from its leading magic and expands it to a temporary file, returning the result as a random-access *File. An uncompressed member is passed through directly, without copying. The caller must File.Close the result to release any backing file.
func DecompressAs ¶
DecompressAs expands the size-byte member ra using the named codec, returning the result as a random-access *File. None passes the member through directly, without copying. The caller must File.Close the result to release any backing file.
func (*File) Close ¶
Close removes the backing temporary file, if any. It is a no-op for an uncompressed member served directly from its source.
func (*File) ReadAt ¶
ReadAt implements io.ReaderAt.