package tartest
import "github.com/containerd/containerd/archive/tartest"
Index ¶
- func TarFromWriterTo(wt WriterToTar) io.ReadCloser
- type TarContext
- func (tc TarContext) Dir(name string, perm os.FileMode) WriterToTar
- func (tc TarContext) File(name string, content []byte, perm os.FileMode) WriterToTar
- func (tc TarContext) Link(oldname, newname string) WriterToTar
- func (tc TarContext) Symlink(oldname, newname string) WriterToTar
- func (tc TarContext) WithModTime(modtime time.Time) TarContext
- func (tc TarContext) WithUIDGID(uid, gid int) TarContext
- func (tc TarContext) WithXattrs(xattrs map[string]string) TarContext
- type WriterToTar
Functions ¶
func TarFromWriterTo ¶
func TarFromWriterTo(wt WriterToTar) io.ReadCloser
TarFromWriterTo is used to create a tar stream from a tar record creator. This can be used to manufacture more specific tar records which allow testing specific tar cases which may be encountered by the untar process.
Types ¶
type TarContext ¶
type TarContext struct { UID int GID int // ModTime sets the modtimes for all files, if nil the current time // is used for each file when it was written ModTime *time.Time Xattrs map[string]string }
TarContext is used to create tar records
func (TarContext) Dir ¶
func (tc TarContext) Dir(name string, perm os.FileMode) WriterToTar
Dir returns a directory tar entry
func (TarContext) File ¶
func (tc TarContext) File(name string, content []byte, perm os.FileMode) WriterToTar
File returns a regular file tar entry using the provided bytes
func (TarContext) Link ¶
func (tc TarContext) Link(oldname, newname string) WriterToTar
Link returns a hard link tar entry
func (TarContext) Symlink ¶
func (tc TarContext) Symlink(oldname, newname string) WriterToTar
Symlink returns a symlink tar entry
func (TarContext) WithModTime ¶
func (tc TarContext) WithModTime(modtime time.Time) TarContext
WithModTime sets the ModTime for tar entries
func (TarContext) WithUIDGID ¶
func (tc TarContext) WithUIDGID(uid, gid int) TarContext
WithUIDGID sets the UID and GID for tar entries
func (TarContext) WithXattrs ¶
func (tc TarContext) WithXattrs(xattrs map[string]string) TarContext
WithXattrs adds these xattrs to all files, merges with any previously added xattrs
type WriterToTar ¶
WriterToTar is an type which writes to a tar writer
func TarAll ¶
func TarAll(wt ...WriterToTar) WriterToTar
TarAll creates a WriterToTar which calls all the provided writers in the order in which they are provided.
Source Files ¶
- Version
- v1.6.0-rc.1
- Published
- Jan 20, 2022
- Platform
- js/wasm
- Imports
- 5 packages
- Last checked
- 3 minutes ago –
Tools for package owners.