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 EqExt(ext1, ext2 string) bool
- 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, tarFormat tar.Format, 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 ReadCB
- type Reader
- type Writer
Constants ¶
const ( ExtTar = ".tar" ExtTgz = ".tgz" ExtTarGz = ".tar.gz" ExtZip = ".zip" ExtTarLz4 = ".tar.lz4" )
supported archive types (file extensions); see also archExts in cmd/cli/cli/const.go NOTE: when adding/removing formats - update:
- FileExtensions
- allMagics
- ext/dsort/shard/rw.go
const TarBlockSize = 512 // Size of each block in a tar stream
Variables ¶
var ErrTarIsEmpty = errors.New("tar is empty")
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(filename, detail string) (e *ErrUnknownFileExt)
func (*ErrUnknownFileExt) Error ¶
func (e *ErrUnknownFileExt) Error() (s 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 ReadCB ¶
usage boils down to a) constructing (`NewReader`) and b) iterating (`Range`) - that's all (all supported formats)
type Reader ¶
type Reader interface { // pass non-empty filename to facilitate a simple/single selection // (generalize as a multi-selection callback? no need yet...) Range(filename string, rcb ReadCB) (cos.ReadCloseSizer, error) // contains filtered or unexported methods }
usage boils down to a) constructing (`NewReader`) and b) iterating (`Range`) - that's all (all supported formats)