Documentation ¶
Index ¶
- type DirObj
- func (d *DirObj) Contents() *DirObj
- func (d *DirObj) Dirs() []*DirObj
- func (d *DirObj) Each(fnFile func(f *FileObj), fnDir func(d *DirObj))
- func (d *DirObj) EachLimit(fnFile func(f *FileObj), fnDir func(d *DirObj), maxDepth int)
- func (d *DirObj) Files() []*FileObj
- func (dir *DirObj) InitWithEmbeddedFS(embeddedFS embed.FS, pathPrefix string, dirMode, fileMode fs.FileMode) error
- func (dir *DirObj) UpdateFromEmbeddedFS(embeddedFS embed.FS, pathPrefix string, dirMode, fileMode fs.FileMode, ...) error
- type FileInfo
- type FileObj
- func (f *FileObj) AsBase64Std() string
- func (f *FileObj) AsBase64URL() string
- func (f *FileObj) AsBytes() []byte
- func (f *FileObj) AsBytesGZ() []byte
- func (f *FileObj) AsString() string
- func (f *FileObj) AsStringGZ() string
- func (f *FileObj) AsURL() string
- func (f *FileObj) BaseDir() string
- func (f *FileObj) CRC32() string
- func (f *FileObj) CRC64() string
- func (f *FileObj) Checksum() *checksum.Checksum
- func (f *FileObj) Copy(destinationPath string) error
- func (f *FileObj) CopyFrom(file *FileObj) error
- func (f *FileObj) Create(perm fs.FileMode) error
- func (f *FileObj) Depth() int
- func (f *FileObj) Dir(name string) *DirObj
- func (f *FileObj) Exec(args ...any) error
- func (f *FileObj) ExecBackground(args ...any) error
- func (f *FileObj) ExecOutput(args ...any) ([]byte, error)
- func (f *FileObj) ExecQuiet(args ...any) error
- func (f *FileObj) Exists() bool
- func (f *FileObj) File(name string) *FileObj
- func (f *FileObj) FileMode() fs.FileMode
- func (f *FileObj) Group() string
- func (f *FileObj) Info() *FileInfo
- func (f *FileObj) IsExecutable() bool
- func (f *FileObj) IsExecutableGroup() bool
- func (f *FileObj) IsExecutableOwner() bool
- func (f *FileObj) IsExecutableWorld() bool
- func (f *FileObj) IsReadable() bool
- func (f *FileObj) IsReadableGroup() bool
- func (f *FileObj) IsReadableOwner() bool
- func (f *FileObj) IsReadableWorld() bool
- func (f *FileObj) IsWritable() bool
- func (f *FileObj) IsWritableGroup() bool
- func (f *FileObj) IsWritableOwner() bool
- func (f *FileObj) IsWritableWorld() bool
- func (f *FileObj) LastModified() time.Time
- func (f *FileObj) LoadBase64Std(target any) error
- func (f *FileObj) LoadBase64URL(target any) error
- func (f *FileObj) LoadBytes(target *[]byte) error
- func (f *FileObj) LoadBytesGZ(target *[]byte) error
- func (f *FileObj) LoadGob(target any) error
- func (f *FileObj) LoadGobGZ(target any) error
- func (f *FileObj) LoadJSON(target any) error
- func (f *FileObj) LoadString(target *string) error
- func (f *FileObj) LoadStringGZ(target *string) error
- func (f *FileObj) LoadURL(target any) error
- func (f *FileObj) LoadYAML(target any) error
- func (f *FileObj) MD5() string
- func (f *FileObj) Mkdir(mode fs.FileMode) error
- func (f *FileObj) Mklink(path string) error
- func (f *FileObj) Mkparent(perm fs.FileMode) error
- func (f *FileObj) MustReadCRC32(target *string) *FileObj
- func (f *FileObj) MustReadCRC64(target *string) *FileObj
- func (f *FileObj) MustReadMD5(target *string) *FileObj
- func (f *FileObj) MustReadSHA1(target *string) *FileObj
- func (f *FileObj) MustReadSHA256(target *string) *FileObj
- func (f *FileObj) MustReadSHA512(target *string) *FileObj
- func (f *FileObj) Name() string
- func (f *FileObj) NewerThan(t time.Time) bool
- func (f *FileObj) OlderThan(t time.Time) bool
- func (f *FileObj) Open() (file *os.File, closer func())
- func (f *FileObj) OpenAppend() (file *os.File, closer func())
- func (f *FileObj) OpenReadOnly() (file *os.File, closer func())
- func (f *FileObj) OpenTruncate() (file *os.File, closer func())
- func (f *FileObj) OpenWriteOnly() (file *os.File, closer func())
- func (f *FileObj) Own(username string) error
- func (f *FileObj) Owner() string
- func (f *FileObj) Parent() *DirObj
- func (f *FileObj) Path() string
- func (f *FileObj) Perm(mode fs.FileMode) error
- func (f *FileObj) PermExec(owner, group, world bool) *FileObj
- func (f *FileObj) PermExecAll() *FileObj
- func (f *FileObj) PermGroup(r, w, x bool) *FileObj
- func (f *FileObj) PermOwner(r, w, x bool) *FileObj
- func (f *FileObj) PermRead(owner, group, world bool) *FileObj
- func (f *FileObj) PermReadAll() *FileObj
- func (f *FileObj) PermWorld(r, w, x bool) *FileObj
- func (f *FileObj) PermWrite(owner, group, world bool) *FileObj
- func (f *FileObj) PermWriteAll() *FileObj
- func (f *FileObj) Permissions() *permissions.Permissions
- func (f *FileObj) ReadBase64Std(target any) *FileObj
- func (f *FileObj) ReadBase64URL(target any) *FileObj
- func (f *FileObj) ReadBytes(target *[]byte) *FileObj
- func (f *FileObj) ReadBytesGZ(target *[]byte) *FileObj
- func (f *FileObj) ReadCRC32(target *string) error
- func (f *FileObj) ReadCRC64(target *string) error
- func (f *FileObj) ReadGob(target any) *FileObj
- func (f *FileObj) ReadGobGZ(target any) *FileObj
- func (f *FileObj) ReadJSON(target any) *FileObj
- func (f *FileObj) ReadMD5(target *string) error
- func (f *FileObj) ReadSHA1(target *string) error
- func (f *FileObj) ReadSHA256(target *string) error
- func (f *FileObj) ReadSHA512(target *string) error
- func (f *FileObj) ReadString(target *string) *FileObj
- func (f *FileObj) ReadStringGZ(target *string) *FileObj
- func (f *FileObj) ReadURL(target any) *FileObj
- func (f *FileObj) ReadYAML(target any) *FileObj
- func (f *FileObj) Remove() error
- func (f *FileObj) RenderFromTemplate(tmpl string, data any, fns template.FuncMap) error
- func (f *FileObj) SHA1() string
- func (f *FileObj) SHA256() string
- func (f *FileObj) SHA512() string
- func (f *FileObj) SameAs(file *FileObj) bool
- func (f *FileObj) SameCRC32As(file *FileObj) bool
- func (f *FileObj) SameCRC64As(file *FileObj) bool
- func (f *FileObj) SameMD5As(file *FileObj) bool
- func (f *FileObj) SameSHA1As(file *FileObj) bool
- func (f *FileObj) SameSHA256As(file *FileObj) bool
- func (f *FileObj) SameSHA512As(file *FileObj) bool
- func (f *FileObj) Size() int64
- func (f *FileObj) StoreBase64Std(data any) error
- func (f *FileObj) StoreBase64URL(data any) error
- func (f *FileObj) StoreBytes(data []byte) error
- func (f *FileObj) StoreBytesGZ(data []byte) error
- func (f *FileObj) StoreGob(data any) error
- func (f *FileObj) StoreGobGZ(data any) error
- func (f *FileObj) StoreJSON(data any) error
- func (f *FileObj) StoreString(data string) error
- func (f *FileObj) StoreStringGZ(data string) error
- func (f *FileObj) StoreURL(data any) error
- func (f *FileObj) StoreYAML(data any) error
- func (f *FileObj) String(lenOwner, lenGroup int) string
- func (f *FileObj) WriteBase64Std(data any) *FileObj
- func (f *FileObj) WriteBase64URL(data any) *FileObj
- func (f *FileObj) WriteBytes(data []byte) *FileObj
- func (f *FileObj) WriteBytesGZ(data []byte) *FileObj
- func (f *FileObj) WriteGob(data any) *FileObj
- func (f *FileObj) WriteGobGZ(data any) *FileObj
- func (f *FileObj) WriteJSON(data any) *FileObj
- func (f *FileObj) WriteString(data string) *FileObj
- func (f *FileObj) WriteStringGZ(data string) *FileObj
- func (f *FileObj) WriteURL(data any) *FileObj
- func (f *FileObj) WriteYAML(data any) *FileObj
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirObj ¶
type DirObj struct { *FileObj // contains filtered or unexported fields }
func (*DirObj) InitWithEmbeddedFS ¶
func (dir *DirObj) InitWithEmbeddedFS(embeddedFS embed.FS, pathPrefix string, dirMode, fileMode fs.FileMode) error
InitWithEmbeddedFS unpacks the given `embeddedFS` into this directory.
It will first remove the directory if it exists and then create it to ensure that we start with a clean slate.
If your embedded FS contains a path prefix (e.g. `//go:embed mysource/*`) and you don't want that replicated when extracting the FS, you can provide it as `pathPrefix` to strip it (e.g. `pathPrefix = "mysource"`).
Be aware that embedded filesystems do not store file permissions. Therefore all dirs and files will be written with the provided permissions `dirMode` and `fileMode` respectively.
func (*DirObj) UpdateFromEmbeddedFS ¶
func (dir *DirObj) UpdateFromEmbeddedFS(embeddedFS embed.FS, pathPrefix string, dirMode, fileMode fs.FileMode, overwriteExisting bool) error
UpdateFromEmbeddedFS works similar to InitWithEmbeddedFS but will not clear the directory before extracting the embedded FS.
Existing files will only be overwritten with the version in the embedded FS if you set `overwriteExisting` to `true`.
type FileInfo ¶
type FileInfo struct { Name string Exists bool LastModified time.Time Mode fs.FileMode Size int64 Path string Checksum *checksum.Checksum Permissions *permissions.Permissions Ownership *ownership.FileOwnership }
type FileObj ¶
type FileObj struct {
// contains filtered or unexported fields
}
func (*FileObj) AsBase64Std ¶
func (*FileObj) AsBase64URL ¶
func (*FileObj) AsStringGZ ¶
func (*FileObj) ExecBackground ¶
func (*FileObj) IsExecutable ¶
func (*FileObj) IsExecutableGroup ¶
func (*FileObj) IsExecutableOwner ¶
func (*FileObj) IsExecutableWorld ¶
func (*FileObj) IsReadable ¶
func (*FileObj) IsReadableGroup ¶
func (*FileObj) IsReadableOwner ¶
func (*FileObj) IsReadableWorld ¶
func (*FileObj) IsWritable ¶
func (*FileObj) IsWritableGroup ¶
func (*FileObj) IsWritableOwner ¶
func (*FileObj) IsWritableWorld ¶
func (*FileObj) LastModified ¶
func (*FileObj) LoadBase64Std ¶
func (*FileObj) LoadBase64URL ¶
func (*FileObj) LoadBytesGZ ¶
func (*FileObj) LoadString ¶
func (*FileObj) LoadStringGZ ¶
func (*FileObj) MustReadCRC32 ¶
func (*FileObj) MustReadCRC64 ¶
func (*FileObj) MustReadMD5 ¶
func (*FileObj) MustReadSHA1 ¶
func (*FileObj) MustReadSHA256 ¶
func (*FileObj) MustReadSHA512 ¶
func (*FileObj) OpenAppend ¶
OpenAppend opens the file for appending, creating the file if it doesn't exist.
func (*FileObj) OpenReadOnly ¶
func (*FileObj) OpenTruncate ¶
OpenTruncate opens the file for writing, creating the file if it doesn't exist. The file will be truncated if it exists.
func (*FileObj) OpenWriteOnly ¶
func (*FileObj) PermExecAll ¶
func (*FileObj) PermReadAll ¶
func (*FileObj) PermWriteAll ¶
func (*FileObj) Permissions ¶
func (f *FileObj) Permissions() *permissions.Permissions