gofs

package module
v0.0.0-...-5ddaa05 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2025 License: MIT Imports: 14 Imported by: 1

README

gofs

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExtPdf = FileExtensionFrom("pdf")
	ExtJpg = FileExtensionFrom("jpg")
	ExtPng = FileExtensionFrom("png")
	ExtLog = FileExtensionFrom("log")
	ExtZip = FileExtensionFrom("zip")
)

Functions

This section is empty.

Types

type Dir

type Dir struct {
	// contains filtered or unexported fields
}

Dir is a filesystem directory.

func DirAt

func DirAt(path string) Dir

func DirWithFs

func DirWithFs(path string, fs afero.Fs) Dir

func WorkingDir

func WorkingDir() Dir

func (Dir) AssertEmpty

func (x Dir) AssertEmpty() Dir

func (Dir) AssertExists

func (x Dir) AssertExists() Dir

func (Dir) AssertNotEmpty

func (x Dir) AssertNotEmpty() Dir

func (Dir) AssertNotExists

func (x Dir) AssertNotExists() Dir

func (Dir) AssertReadable

func (x Dir) AssertReadable() Dir

func (Dir) AssertWritable

func (x Dir) AssertWritable() Dir

func (Dir) Clear

func (x Dir) Clear() error

func (Dir) Create

func (x Dir) Create(perm os.FileMode) error

func (Dir) DirAt

func (x Dir) DirAt(relativePath string) (Dir, error)

func (Dir) Ensure

func (x Dir) Ensure(perm os.FileMode) error

func (Dir) EnsureEmpty

func (x Dir) EnsureEmpty(perm os.FileMode) error

func (Dir) Equals

func (x Dir) Equals(otherDir Dir) bool

func (Dir) Exists

func (x Dir) Exists() bool

func (Dir) FileAt

func (x Dir) FileAt(relativePath string) (File, error)

func (Dir) Files

func (x Dir) Files() ([]File, error)

func (Dir) IsEmpty

func (x Dir) IsEmpty() bool

func (Dir) IsReadable

func (x Dir) IsReadable() bool

func (Dir) IsWritable

func (x Dir) IsWritable() bool

func (Dir) MustClear

func (x Dir) MustClear() Dir

func (Dir) MustDirAt

func (x Dir) MustDirAt(relativePath string) Dir

func (Dir) MustEnsure

func (x Dir) MustEnsure(perm os.FileMode) Dir

func (Dir) MustFileAt

func (x Dir) MustFileAt(relativePath string) File

func (Dir) Name

func (x Dir) Name() string

Name returns the last path element.

func (Dir) NotExists

func (x Dir) NotExists() bool

func (Dir) OpenStandard

func (x Dir) OpenStandard() error

func (Dir) Parent

func (x Dir) Parent() Dir

func (Dir) Path

func (x Dir) Path() string

func (Dir) ReadDir

func (x Dir) ReadDir() ([]os.FileInfo, error)

func (Dir) RelativeTo

func (x Dir) RelativeTo(dir Dir) string

func (Dir) Remove

func (x Dir) Remove() error

func (Dir) String

func (x Dir) String() string

func (Dir) WithTrailingPathSeparator

func (x Dir) WithTrailingPathSeparator() string

func (Dir) WithoutTrailingPathSeparator

func (x Dir) WithoutTrailingPathSeparator() string

type DirPathNotRelativeError

type DirPathNotRelativeError struct {
	// contains filtered or unexported fields
}

func NewDirPathNotRelativeError

func NewDirPathNotRelativeError(path string) *DirPathNotRelativeError

func (DirPathNotRelativeError) Error

func (x DirPathNotRelativeError) Error() string

type File

type File struct {
	// contains filtered or unexported fields
}

File is a file in the filesystem.

func FileAt

func FileAt(filePath string) File

func FileAtDir

func FileAtDir(dir Dir, filename string) File

func FileWithFs

func FileWithFs(filePath string, fs afero.Fs) File

func (File) Append

func (x File) Append(newContent []byte) error

func (File) AppendString

func (x File) AppendString(newContent string) error

func (File) AppendStringln

func (x File) AppendStringln(newContent string) error

func (File) AssertEmpty

func (x File) AssertEmpty() File

func (File) AssertExists

func (x File) AssertExists() File

func (File) AssertExtension

func (x File) AssertExtension(fileExtension FileExtension) File

func (File) AssertMd5Hash

func (x File) AssertMd5Hash(hash string) File

func (File) AssertNotEmpty

func (x File) AssertNotEmpty() File

func (File) AssertNotExists

func (x File) AssertNotExists() File

func (File) AssertReadable

func (x File) AssertReadable() File

func (File) AssertWritable

func (x File) AssertWritable() File

func (File) Clear

func (x File) Clear() error

func (File) Content

func (x File) Content() ([]byte, error)

func (File) ContentString

func (x File) ContentString() (string, error)

func (File) CopyTo

func (x File) CopyTo(target File) error

func (File) CopyToDir

func (x File) CopyToDir(target Dir) error

func (File) Dir

func (x File) Dir() Dir

func (File) EnsureDir

func (x File) EnsureDir(perm os.FileMode) error

func (File) Equals

func (x File) Equals(otherFile File) bool

func (File) Exists

func (x File) Exists() bool

func (File) Extension

func (x File) Extension() *FileExtension

func (File) Filename

func (x File) Filename() string

func (File) FilenameWithoutExtension

func (x File) FilenameWithoutExtension() string

func (File) Filesize

func (x File) Filesize() int64

func (File) FilesizeHuman

func (x File) FilesizeHuman() string

func (File) HasAnyExtension

func (x File) HasAnyExtension() bool

func (File) HasExtension

func (x File) HasExtension(fileExtension FileExtension) bool

func (File) InDir

func (x File) InDir(dir Dir) File

func (File) IsEmpty

func (x File) IsEmpty() bool

func (File) IsHidden

func (x File) IsHidden() bool

func (File) IsReadable

func (x File) IsReadable() bool

func (File) IsWritable

func (x File) IsWritable() bool

func (File) Md5Hash

func (x File) Md5Hash() (string, error)

func (File) MustClear

func (x File) MustClear() File

func (File) MustContent

func (x File) MustContent() []byte

func (File) MustContentString

func (x File) MustContentString() string

func (File) MustEnsureDir

func (x File) MustEnsureDir(perm os.FileMode) File

func (File) MustMd5Hash

func (x File) MustMd5Hash() string

func (File) MustRemove

func (x File) MustRemove() File

func (File) MustRenderer

func (x File) MustRenderer() *Renderer

func (File) NotExists

func (x File) NotExists() bool

func (File) OpenStandard

func (x File) OpenStandard() error

func (File) ParentDir

func (x File) ParentDir() Dir

func (File) Path

func (x File) Path() string

func (File) RelativeTo

func (x File) RelativeTo(to Dir) string

func (File) Remove

func (x File) Remove() error

func (File) Renderer

func (x File) Renderer() (*Renderer, error)

func (File) SetContent

func (x File) SetContent(newContent []byte) error

func (File) SetContentString

func (x File) SetContentString(newContent string) error

func (File) SetCreatePermissions

func (x File) SetCreatePermissions(perm os.FileMode) File

SetCreatePermissions allows you to define the FileMode used when creating this file (if it did not exist).

func (File) String

func (x File) String() string

func (File) WithExtension

func (x File) WithExtension(fileExtension FileExtension) File

func (File) WithFileReadOnly

func (x File) WithFileReadOnly(logic func(f afero.File) error) error

func (File) WithFilename

func (x File) WithFilename(filename string) File

func (File) WithoutExtension

func (x File) WithoutExtension() File

func (File) Writer

func (x File) Writer() (io.WriteCloser, error)

type FileExtension

type FileExtension struct {
	// contains filtered or unexported fields
}

func FileExtensionFrom

func FileExtensionFrom(extension string) FileExtension

func (FileExtension) String

func (x FileExtension) String() string

func (FileExtension) WithDot

func (x FileExtension) WithDot() string

func (FileExtension) WithoutDot

func (x FileExtension) WithoutDot() string

type FilePathNotRelativeError

type FilePathNotRelativeError struct {
	// contains filtered or unexported fields
}

func NewFilePathNotRelativeError

func NewFilePathNotRelativeError(path string) *FilePathNotRelativeError

func (FilePathNotRelativeError) Error

func (x FilePathNotRelativeError) Error() string

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

func NewRenderer

func NewRenderer(templateData []byte) *Renderer

func NewRendererFromFile

func NewRendererFromFile(templateFile File) (*Renderer, error)

func (*Renderer) AddFuncs

func (x *Renderer) AddFuncs(funcs template.FuncMap) *Renderer

func (*Renderer) RenderTo

func (x *Renderer) RenderTo(w io.Writer) error

func (*Renderer) RenderToFile

func (x *Renderer) RenderToFile(f File) error

func (*Renderer) WithData

func (x *Renderer) WithData(data any) *Renderer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL