go1.20.5
GoThrough

tar.FormatGNU

// Constants to identify various tar formats. // FormatGNU represents the GNU header format. // // The GNU header format is older than the USTAR and PAX standards and // is not compatible with them. The GNU format supports // arbitrary file sizes, filenames of arbitrary encoding and length, // sparse files, and other features. // // It is recommended that PAX be chosen over GNU unless the target // application can only parse GNU formatted archives. // // Reference: // https://www.gnu.org/software/tar/manual/html_node/Standard.html const FormatGNU

tar.FormatPAX

// Constants to identify various tar formats. // FormatPAX represents the PAX header format defined in POSIX.1-2001. // // PAX extends USTAR by writing a special file with Typeflag TypeXHeader // preceding the original header. This file contains a set of key-value // records, which are used to overcome USTAR's shortcomings, in addition to // providing the ability to have sub-second resolution for timestamps. // // Some newer formats add their own extensions to PAX by defining their // own keys and assigning certain semantic meaning to the associated values. // For example, sparse file support in PAX is implemented using keys // defined by the GNU manual (e.g., "GNU.sparse.map"). // // Reference: // http://pubs.opengroup.org/onlinepubs/009695399/utilities/pax.html const FormatPAX

tar.FormatUSTAR

// Constants to identify various tar formats. // FormatUSTAR represents the USTAR header format defined in POSIX.1-1988. // // While this format is compatible with most tar readers, // the format has several limitations making it unsuitable for some usages. // Most notably, it cannot support sparse files, files larger than 8GiB, // filenames larger than 256 characters, and non-ASCII filenames. // // Reference: // http://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html#tag_20_92_13_06 const FormatUSTAR

tar.FormatUnknown

// Constants to identify various tar formats. // FormatUnknown indicates that the format is unknown. const FormatUnknown

tar.TypeBlock

// Type flags for Header.Typeflag. const TypeBlock = '4'

tar.TypeChar

// Type flags for Header.Typeflag. const TypeChar = '3'

tar.TypeCont

// Type flags for Header.Typeflag. // Type '7' is reserved. const TypeCont = '7'

tar.TypeDir

// Type flags for Header.Typeflag. const TypeDir = '5'

tar.TypeFifo

// Type flags for Header.Typeflag. const TypeFifo = '6'

tar.TypeGNULongLink

// Type flags for Header.Typeflag. const TypeGNULongLink = 'K'

tar.TypeGNULongName

// Type flags for Header.Typeflag. // Types 'L' and 'K' are used by the GNU format for a meta file // used to store the path or link name for the next file. // This package transparently handles these types. const TypeGNULongName = 'L'

tar.TypeGNUSparse

// Type flags for Header.Typeflag. // Type 'S' indicates a sparse file in the GNU format. const TypeGNUSparse = 'S'

tar.TypeLink

// Type flags for Header.Typeflag. // Type '1' to '6' are header-only flags and may not have a data body. const TypeLink = '1'

tar.TypeReg

// Type flags for Header.Typeflag. // Type '0' indicates a regular file. const TypeReg = '0'

tar.TypeRegA

// Type flags for Header.Typeflag. // Deprecated: Use TypeReg instead. const TypeRegA = '\x00'

tar.TypeSymlink

// Type flags for Header.Typeflag. const TypeSymlink = '2'

tar.TypeXGlobalHeader

// Type flags for Header.Typeflag. // Type 'g' is used by the PAX format to store key-value records that // are relevant to all subsequent files. // This package only supports parsing and composing such headers, // but does not currently support persisting the global state across files. const TypeXGlobalHeader = 'g'

tar.TypeXHeader

// Type flags for Header.Typeflag. // Type 'x' is used by the PAX format to store key-value records that // are only relevant to the next file. // This package transparently handles these types. const TypeXHeader = 'x'

tar.ErrFieldTooLong

var ErrFieldTooLong = errors.New("archive/tar: header field too long")

tar.ErrHeader

var ErrHeader = errors.New("archive/tar: invalid tar header")

tar.ErrInsecurePath

var ErrInsecurePath = errors.New("archive/tar: insecure file path")

tar.ErrWriteAfterClose

var ErrWriteAfterClose = errors.New("archive/tar: write after close")

tar.ErrWriteTooLong

var ErrWriteTooLong = errors.New("archive/tar: write too long")

tar.FileInfoHeader

// FileInfoHeader creates a partially-populated Header from fi. // If fi describes a symlink, FileInfoHeader records link as the link target. // If fi describes a directory, a slash is appended to the name. // // Since fs.FileInfo's Name method only returns the base name of // the file it describes, it may be necessary to modify Header.Name // to provide the full path name of the file. func FileInfoHeader(fi fs.FileInfo, link string) (*Header, error)

tar.NewReader

// NewReader creates a new Reader reading from r. func NewReader(r io.Reader) *Reader

tar.NewWriter

// NewWriter creates a new Writer writing to w. func NewWriter(w io.Writer) *Writer