Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToIOReader ¶
ToIOReader converts the files in an Archive to an io.Reader bytes buffer.
func ToRelocatedTarGz ¶
ToRelocatedTarGz converts the files in an Archive into a gzipped tarfile relocated with the specified path prefix.
Types ¶
type Archive ¶
type Archive []Item
Archive contains an ordered list of Item objects, much like a tarball.
func (Archive) ContainsFilePrefix ¶
ContainsFilePrefix returns true if any Item present in an Archive has the specified prefix (i.e. is under that directory).
func (Archive) ContainsPath ¶
ContainsPath returns if Item with the exact path given is present in an Archive.
type Item ¶
type Item struct { // Path should include the filename. For directories, it should not end in a '/'. Path string `json:"path"` // Type should match the tar.Header.Typeflag values. Type byte `json:"type"` Content byteString `json:"content"` FileMode os.FileMode `json:"mode"` ModifiedTime UnixTime `json:"mtime"` UserID int `json:"uid"` GroupID int `json:"gid"` IsRootItem bool `json:"isRootItem"` }
Item is an in-memory representation of a file. It contains the content and additional metadata of a file.
func RootItem ¶
RootItem returns a new Item which will be owned by root when embedded in a container.
func UserItem ¶
UserItem returns a new Item which will be owned by the user under which the container runs.
type UnixTime ¶
UnixTime is a wrapper around time.Time that serializes to a Unix timestamp. This is a lossy conversion because time.Time also contains time zone and nanosecond information, so this type is only appropriate for dealing with legacy systems.
func (UnixTime) MarshalJSON ¶
MarshalJSON marshals a UnixTime as seconds since the epoch.
func (*UnixTime) UnmarshalJSON ¶
UnmarshalJSON unmarshals seconds since the epoch into a UnixTime.