Documentation ¶
Overview ¶
Package tarski implements a simple library to deal with the creation and extraction of tar archives and allows for content hashes.
Content hashes are created based on the tar stream. That is to say the hash is based on the content of all files that are copied into the tar archive.
Index ¶
- func Create(archive string, path string, prefix string) (err error)
- func CreateSHA256(archive string, path string, prefix string) (checksum []byte, err error)
- func Extract(archive string, path string) error
- func ExtractDev(path string, h *tar.Header) (err error)
- func ExtractDir(path string, h *tar.Header) (err error)
- func ExtractReg(path string, h *tar.Header, r *tar.Reader) (err error)
- func ExtractSHA256(archive string, path string) (checksum []byte, err error)
- func ExtractSymlink(path string, h *tar.Header) (err error)
- func GetAllXattr(path string) (xattrs map[string]string, err error)
- func IsEmpty(archive string) (bool, error)
- func WriteHeader(w *tar.Writer, path string, entry string, f os.FileInfo) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Create ¶
Create creates a tar archive. The string given by prefix will be stripped from all entries found under path.
func CreateSHA256 ¶
CreateSHA256 creates a tar archive and returns its SHA256-hash checksum. The SHA256 hash of the tar archive is created based on the tar stream and not simply on the resulting archive. This is a proper content hash. The string given by prefix will be stripped from all entries found under path.
func ExtractDev ¶
ExtractDev extracts a device file from a tar archive.
func ExtractDir ¶
ExtractDir extracts a directory from a tar archive.
func ExtractReg ¶
ExtractReg extracts a regular file from a tar archive.
func ExtractSHA256 ¶
ExtractSHA256 extracts a tar archive under path and returns its SHA256-hash checksum. The SHA256 hash of the tar archive is created based on the tar stream and not simply on the resulting archive. This is a proper content hash.
func ExtractSymlink ¶
ExtractSymlink extracts a symbolic link from a tar archive.
func GetAllXattr ¶
GetAllXattr retrieves all extended attributes associated with a file, directory or symbolic link.
Types ¶
This section is empty.