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-2024, 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-2024, NVIDIA CORPORATION. All rights reserved.
Package archive: write, read, copy, append, list primitives across all supported formats
- Copyright (c) 2018-2024, 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 cos.LomReader, smm *memsys.MMSA, mime, archname string) (m string, err error)
- func OpenTarForAppend(cname, workFQN string) (rwfh *os.File, tarFormat tar.Format, offset int64, err error)
- func SetTarHeader(hdr any)
- func Strict(mime, filename string) (m string, err error)
- func ValidateMatchMode(mmode string) (_ string, err error)
- type ArchRCB
- type Entry
- type ErrMatchMode
- type ErrUnknownFileExt
- type ErrUnknownMime
- type HeaderCallback
- type Opts
- 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")
var MatchMode = [...]string{
"regexp",
"prefix",
"suffix",
"substr",
"wdskey",
}
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 OpenTarForAppend ¶ added in v1.3.24
func SetTarHeader ¶
func SetTarHeader(hdr any)
func ValidateMatchMode ¶ added in v1.3.23
Types ¶
type ArchRCB ¶ added in v1.3.23
to use, construct (`NewReader`) and iterate (`RangeUntil`) (all supported formats) simple/single selection is also supported (`ReadOne`)
type ErrMatchMode ¶ added in v1.3.23
type ErrMatchMode struct {
// contains filtered or unexported fields
}
func (*ErrMatchMode) Error ¶ added in v1.3.23
func (e *ErrMatchMode) Error() string
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 Reader ¶
type Reader interface { // - call rcb (reader's callback) with each matching archived file, where: // - `regex` is the matching string that gets interpreted according // to one of the enumerated "matching modes" (see MatchMode); // - an empty `regex` is just another case of cos.EmptyMatchAll - i.e., matches all archived files // - stop upon EOF, or when rcb returns true (ie., stop) or any error ReadUntil(rcb ArchRCB, regex, mmode string) error // simple/single selection of a given archived filename (full path) ReadOne(filename string) (cos.ReadCloseSizer, error) // contains filtered or unexported methods }
to use, construct (`NewReader`) and iterate (`RangeUntil`) (all supported formats) simple/single selection is also supported (`ReadOne`)