Documentation
¶
Overview ¶
Package encoder creates pxar archives.
Index ¶
- type Encoder
- func (e *Encoder) AddDevice(metadata *pxar.Metadata, name string, device format.Device) error
- func (e *Encoder) AddFIFO(metadata *pxar.Metadata, name string) error
- func (e *Encoder) AddFile(metadata *pxar.Metadata, name string, content []byte) (LinkOffset, error)
- func (e *Encoder) AddHardlink(name string, target string, targetOffset LinkOffset) error
- func (e *Encoder) AddSocket(metadata *pxar.Metadata, name string) error
- func (e *Encoder) AddSymlink(metadata *pxar.Metadata, name string, target string) error
- func (e *Encoder) Close() error
- func (e *Encoder) CreateDirectory(name string, metadata *pxar.Metadata) error
- func (e *Encoder) CreateFile(metadata *pxar.Metadata, name string, size uint64) (*FileWriter, error)
- func (e *Encoder) Finish() error
- type FileWriter
- type LinkOffset
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder writes pxar archives.
func NewEncoder ¶
NewEncoder creates a new pxar encoder writing to the given writers. If payloadOut is non-nil, the archive is split (v2 format). metadata describes the root directory. prelude is optional v2 prelude data.
func (*Encoder) AddHardlink ¶
func (e *Encoder) AddHardlink(name string, target string, targetOffset LinkOffset) error
AddHardlink adds a hard link.
func (*Encoder) AddSymlink ¶
AddSymlink adds a symbolic link.
func (*Encoder) CreateDirectory ¶
CreateDirectory pushes a new directory onto the stack.
func (*Encoder) CreateFile ¶
func (e *Encoder) CreateFile(metadata *pxar.Metadata, name string, size uint64) (*FileWriter, error)
CreateFile returns a FileWriter for streaming file content.
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
FileWriter writes file content to a pxar archive.
func (*FileWriter) FileOffset ¶
func (fw *FileWriter) FileOffset() LinkOffset
FileOffset returns the file's offset for use with AddHardlink.
func (*FileWriter) Write ¶
func (fw *FileWriter) Write(data []byte) (int, error)
Write writes data to the file.
func (*FileWriter) WriteAll ¶
func (fw *FileWriter) WriteAll(data []byte) error
WriteAll writes all data to the file.
type LinkOffset ¶
type LinkOffset uint64
LinkOffset represents a file offset usable with AddHardlink.