Documentation ¶
Overview ¶
Package archive: write, read, copy, append, list primitives across all supported formats
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package archive: write, read, copy, append, list primitives across all supported formats
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package archive: write, read, copy, append, list primitives across all supported formats
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package archive: write, read, copy, append, list primitives across all supported formats
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package archive: write, read, copy, append, list primitives across all supported formats
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package archive: write, read, copy, append, list primitives across all supported formats
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Package archive: write, read, copy, append, list primitives across all supported formats
- Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
Index ¶
- Constants
- Variables
- func GetReader(fh *os.File, archname, filename, mime string, size int64) (cos.ReadCloseSizer, error)
- func Init(f feat.Flags)
- func IsErrUnknownFileExt(err error) bool
- func IsErrUnknownMime(err error) bool
- func Mime(mime, filename string) (string, error)
- func MimeFQN(smm *memsys.MMSA, mime, archname string) (m string, err error)
- func MimeFile(file *os.File, smm *memsys.MMSA, mime, archname string) (m string, err error)
- func OpenTarSeekEnd(cname, workFQN string) (rwfh *os.File, err error)
- func SetTarHeader(hdr any)
- func Strict(mime, filename string) (m string, err error)
- type Entry
- type ErrUnknownFileExt
- type ErrUnknownMime
- type HeaderCallback
- type Opts
- type Writer
Constants ¶
const ( ExtTar = ".tar" ExtTgz = ".tgz" ExtTarTgz = ".tar.gz" ExtZip = ".zip" ExtTarLz4 = ".tar.lz4" )
supported archive types (file extensions); ref cmd/cli/cli/const.go archExts
const TarBlockSize = 512 // Size of each block in a tar stream
Variables ¶
var ErrTarIsEmpty = errors.New("tar is empty")
NOTE: when adding/removing check `allMagic` as well
Functions ¶
func IsErrUnknownFileExt ¶
func IsErrUnknownMime ¶
func MimeFQN ¶
NOTE: - on purpose redundant vs the above - not to open file if can be avoided - convention: caller may pass nil `smm` _not_ to spend time (usage: listing and reading)
func MimeFile ¶
NOTE convention: caller may pass nil `smm` _not_ to spend time (usage: listing and reading)
func OpenTarSeekEnd ¶
Opens TAR and uses its reader's Next() to skip to the position right _after_ the last file in the TAR (padding bytes including).
Background: TAR file is padded with one or more 512-byte blocks of zero bytes. The blocks must be overwritten, otherwise newly added files won't be accessible. Different TAR formats (such as `ustar`, `pax` and `GNU`) write different number of zero blocks.
func SetTarHeader ¶
func SetTarHeader(hdr any)
Types ¶
type ErrUnknownFileExt ¶
type ErrUnknownFileExt struct {
// contains filtered or unexported fields
}
assorted errors
func NewErrUnknownFileExt ¶
func NewErrUnknownFileExt(d string) *ErrUnknownFileExt
func (*ErrUnknownFileExt) Error ¶
func (e *ErrUnknownFileExt) Error() string
type ErrUnknownMime ¶
type ErrUnknownMime struct {
// contains filtered or unexported fields
}
assorted errors
func NewErrUnknownMime ¶
func NewErrUnknownMime(d string) *ErrUnknownMime
func (*ErrUnknownMime) Error ¶
func (e *ErrUnknownMime) Error() string
type HeaderCallback ¶
type HeaderCallback func(any)
type Opts ¶
type Opts struct { CB HeaderCallback Serialize bool }