Documentation ¶
Index ¶
- Variables
- func AddFileToTar(tw *tar.Writer, path string, txt string) error
- func CreateSingleFileTar(tarFile, path, txt string) error
- func CreateSingleFileTarReader(path, txt string) (io.Reader, error)
- func GenerateTar(gen func(*tar.Writer) error) io.ReadCloser
- func IsZip(file io.Reader) (bool, error)
- func NormalizeHeader(header *tar.Header)
- func ReadDirAsTar(srcDir, basePath string, uid, gid int, mode int64) io.ReadCloser
- func ReadTarEntry(rc io.Reader, entryPath string) (*tar.Header, []byte, error)
- func ReadZipAsTar(srcPath, basePath string, uid, gid int, mode int64) io.ReadCloser
- func WriteDirToTar(tw *tar.Writer, srcDir, basePath string, uid, gid int, mode int64) error
- func WriteZipToTar(tw *tar.Writer, srcZip, basePath string, uid, gid int, mode int64) error
- type TarBuilder
- func (t *TarBuilder) AddDir(path string, mode int64, modTime time.Time)
- func (t *TarBuilder) AddFile(path string, mode int64, modTime time.Time, contents []byte)
- func (t *TarBuilder) Reader() io.ReadCloser
- func (t *TarBuilder) WriteTo(writer io.Writer) (int64, error)
- func (t *TarBuilder) WriteToPath(path string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEntryNotExist = errors.New("not exist")
View Source
var NormalizedDateTime time.Time
Functions ¶
func CreateSingleFileTar ¶
func GenerateTar ¶
func GenerateTar(gen func(*tar.Writer) error) io.ReadCloser
GenerateTar returns a reader to a tar from a generator function. Note that the generator will not fully execute until the reader is fully read from. Any errors returned by the generator will be returned when reading the reader.
func NormalizeHeader ¶
NormalizeHeader normalizes a tar.Header
Normalizes the following:
- ModTime
- GID
- UID
- User Name
- Group Name
func ReadDirAsTar ¶
func ReadDirAsTar(srcDir, basePath string, uid, gid int, mode int64) io.ReadCloser
func ReadZipAsTar ¶
func ReadZipAsTar(srcPath, basePath string, uid, gid int, mode int64) io.ReadCloser
func WriteDirToTar ¶
Types ¶
type TarBuilder ¶
type TarBuilder struct {
// contains filtered or unexported fields
}
func (*TarBuilder) Reader ¶
func (t *TarBuilder) Reader() io.ReadCloser
func (*TarBuilder) WriteToPath ¶
func (t *TarBuilder) WriteToPath(path string) error
Click to show internal directories.
Click to hide internal directories.