# README
builder
Package builder provides a tar archive builder essentially for testing purposes.
Types
type ArchiveBuilder
type ArchiveBuilder struct { ... }
ArchiveBuilder is a tar archive builder.
func New
func New(w io.Writer) *ArchiveBuilder
New creates a new tar archive builder.
func (*ArchiveBuilder) Close
func (b *ArchiveBuilder) Close() error
Close closes the tar writer.
func (*ArchiveBuilder) With
func (b *ArchiveBuilder) With(bf ...Option) (*ArchiveBuilder, error)
With applies the given options to the builder.
type HeaderModifier
type HeaderModifier func(h *tar.Header) error
HeaderModifier is a function that modifies a tar header.
func WithAccessTime
func WithAccessTime(accessTime time.Time) HeaderModifier
WithAccessTime sets the access time of the header.
func WithChangeTime
func WithChangeTime(changeTime time.Time) HeaderModifier
WithChangeTime sets the change time of the header.
func WithGID
func WithGID(gid int) HeaderModifier
WithGID sets the GID of the header.
func WithLinkname
func WithLinkname(linkname string) HeaderModifier
WithLinkname sets the link name of the header.
func WithModTime
func WithModTime(modTime time.Time) HeaderModifier
WithModTime sets the modification time of the header.
func WithMode
func WithMode(mode int64) HeaderModifier
WithMode sets the mode of the header.
func WithName
func WithName(name string) HeaderModifier
WithName sets the name of the header.
func WithSize
func WithSize(size int64) HeaderModifier
WithSize sets the size of the header.
func WithTypeflag
func WithTypeflag(typeFlag byte) HeaderModifier
WithTypeflag sets the type flag of the header.
func WithUID
func WithUID(uid int) HeaderModifier
WithUID sets the UID of the header.
type Option
type Option func(tw *tar.Writer) error
Option is a function that configures the builder.
func Dir
func Dir(name string, hm ...HeaderModifier) Option
Dir adds a directory to the archive.
func FS
func FS(fsys fs.FS) Option
FS adds a file system to the archive.
func File
func File(name string, r io.Reader, hm ...HeaderModifier) Option
File adds a file to the archive.
func Hardlink
func Hardlink(name, target string, hm ...HeaderModifier) Option
Hardlink adds a hard link to the archive.
func Symlink
func Symlink(name, target string, hm ...HeaderModifier) Option
Symlink adds a symbolic link to the archive.