Documentation ¶
Index ¶
- func CheckForFileData(fs FileSystem, url, mount string) (data []byte, mime, path string, ok bool)
- func EnumerateCheckPaths(src string) (checkPaths []string)
- func FileExists(path string) (exists bool)
- func FindFileMime(path string) (mime string, err error)
- func FindFileShasum(path string) (shasum string, err error)
- func ListAllDirs(path string) (dirs []string, err error)
- func ListAllFiles(path string) (files []string)
- func ListDirs(path string) (dirs []string, err error)
- func ListFiles(path string) (files []string)
- func LookupFilePath(fs FileSystem, basePath string, extensions ...string) (path string, present bool)
- func PruneRootFrom[T string | []string](root string, path T) (pruned T)
- func PruneRootFromSlice(root string, slice []string) (pruned []string)
- func PruneRootFromString(root string, path string) (pruned string)
- func PruneRootPrefixes(path string) (pruned string)
- type File
- type FileSystem
- type FileSystems
- type GormFileSystem
- type QueryFileSystem
- type RWFileSystem
- type Registry
- type RegistryLookup
- type WrapFileSystem
- func (w WrapFileSystem) CloneROFS() (cloned FileSystem)
- func (w WrapFileSystem) Exists(path string) (exists bool)
- func (w WrapFileSystem) FileCreated(path string) (created int64, err error)
- func (w WrapFileSystem) FileStats(path string) (mime, shasum string, created, updated time.Time, err error)
- func (w WrapFileSystem) FindFilePath(prefix string, extensions ...string) (path string, err error)
- func (w WrapFileSystem) ID() (id string)
- func (w WrapFileSystem) LastModified(path string) (updated int64, err error)
- func (w WrapFileSystem) ListAllDirs(path string) (paths []string, err error)
- func (w WrapFileSystem) ListAllFiles(path string) (paths []string, err error)
- func (w WrapFileSystem) ListDirs(path string) (paths []string, err error)
- func (w WrapFileSystem) ListFiles(path string) (paths []string, err error)
- func (w WrapFileSystem) MimeType(path string) (mime string, err error)
- func (w WrapFileSystem) Name() (name string)
- func (w WrapFileSystem) Open(path string) (file fs.File, err error)
- func (w WrapFileSystem) ReadDir(path string) (entries []fs.DirEntry, err error)
- func (w WrapFileSystem) ReadFile(path string) (data []byte, err error)
- func (w WrapFileSystem) ReadPageMatter(path string) (pm *matter.PageMatter, err error)
- func (w WrapFileSystem) Sha256(path string) (shasum string, err error)
- func (w WrapFileSystem) Shasum(path string) (shasum string, err error)
- type WrapRWFileSystem
- func (w WrapRWFileSystem) BeginTransaction()
- func (w WrapRWFileSystem) ChangeTimes(path string, created, updated time.Time) (err error)
- func (w WrapRWFileSystem) CloneRWFS() (cloned RWFileSystem)
- func (w WrapRWFileSystem) CommitTransaction()
- func (w WrapRWFileSystem) EndTransaction()
- func (w WrapRWFileSystem) ID() (id string)
- func (w WrapRWFileSystem) MakeDir(path string, perm os.FileMode) (err error)
- func (w WrapRWFileSystem) MakeDirAll(path string, perm os.FileMode) (err error)
- func (w WrapRWFileSystem) Remove(path string) (err error)
- func (w WrapRWFileSystem) RemoveAll(path string) (err error)
- func (w WrapRWFileSystem) RemovePageMatter(path string) (err error)
- func (w WrapRWFileSystem) RollbackTransaction()
- func (w WrapRWFileSystem) WriteFile(path string, data []byte, perm os.FileMode) (err error)
- func (w WrapRWFileSystem) WritePageMatter(pm *matter.PageMatter) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckForFileData ¶
func CheckForFileData(fs FileSystem, url, mount string) (data []byte, mime, path string, ok bool)
func EnumerateCheckPaths ¶
func FileExists ¶
func FindFileMime ¶
func FindFileShasum ¶
func ListAllDirs ¶
func ListAllFiles ¶
func LookupFilePath ¶ added in v0.2.0
func LookupFilePath(fs FileSystem, basePath string, extensions ...string) (path string, present bool)
func PruneRootFrom ¶ added in v0.2.0
func PruneRootFromSlice ¶ added in v0.2.1
func PruneRootFromString ¶ added in v0.2.1
func PruneRootPrefixes ¶ added in v0.2.0
Types ¶
type FileSystem ¶
type FileSystem interface { // ID is the filesystem identifier (kebab-cased feature tag) ID() (id string) // CloneROFS clones the existing filesystem as a new Read-Only instance CloneROFS() (cloned FileSystem) // Name is the underlying root path of the filesystem (not the mount-point) Name() (name string) Open(path string) (fh fs.File, err error) ListDirs(path string) (paths []string, err error) ListFiles(path string) (paths []string, err error) ListAllDirs(path string) (paths []string, err error) ListAllFiles(path string) (paths []string, err error) ReadDir(path string) (paths []fs.DirEntry, err error) ReadFile(path string) (content []byte, err error) MimeType(path string) (mime string, err error) // Shasum returns the 10-character, lower-cased hex encoded shasum of the file Shasum(path string) (shasum string, err error) // Sha256 returns the complete sha256 (hexadecimal encoded) hash of the file Sha256(path string) (shasum string, err error) FileCreated(path string) (created int64, err error) LastModified(path string) (dateTime int64, err error) Exists(path string) (exists bool) FileStats(path string) (mime, shasum string, created, updated time.Time, err error) FindFilePath(path string, extensions ...string) (realpath string, err error) ReadPageMatter(path string) (pm *matter.PageMatter, err error) }
func GetFileSystem ¶ added in v0.2.11
func GetFileSystem(id string) (f FileSystem, ok bool)
func Wrap ¶
func Wrap(path string, fs FileSystem) (out FileSystem, err error)
type FileSystems ¶ added in v0.4.0
type FileSystems []FileSystem
type GormFileSystem ¶ added in v0.2.2
type QueryFileSystem ¶ added in v0.2.0
type QueryFileSystem interface { FindPathsWithContextKey(path, key string) (found []string, err error) FindPathsWhereContextKeyEquals(path, key string, value interface{}) (found []string, err error) FindPathsWhereContextEquals(path string, conditions map[string]interface{}) (found []string, err error) FindPathsWhereContext(path string, orJsonConditions ...map[string]interface{}) (found []string, err error) }
type RWFileSystem ¶ added in v0.1.0
type RWFileSystem interface { FileSystem CloneRWFS() (cloned RWFileSystem) BeginTransaction() RollbackTransaction() CommitTransaction() EndTransaction() MakeDir(path string, perm os.FileMode) (err error) MakeDirAll(path string, perm os.FileMode) (err error) Remove(path string) (err error) RemoveAll(path string) (err error) WriteFile(path string, data []byte, perm os.FileMode) (err error) ChangeTimes(path string, created, updated time.Time) (err error) WritePageMatter(pm *matter.PageMatter) (err error) RemovePageMatter(path string) (err error) }
func WrapRW ¶ added in v0.1.0
func WrapRW(path string, fs RWFileSystem) (out RWFileSystem, err error)
type Registry ¶ added in v0.4.0
type Registry interface { // ID returns the identifier used when constructing the registry ID() (id string) // Register adds the given filesystems to the specified mount point Register(mount string, f ...FileSystem) // GetFileSystem returns the first FileSystem with the given identifier (not the same as ID) GetFileSystem(id string) (f FileSystem, ok bool) Lookup() (rl RegistryLookup) }
func NewRegistry ¶ added in v0.4.0
type RegistryLookup ¶ added in v0.4.0
type RegistryLookup interface { // FileExists returns true if any of the known filesystems have a file matching the given path FileExists(path string) (exists bool) // ReadFile returns the file data ReadFile(path string) (data []byte, err error) // FindFileShasum returns the 10-character, hex encoded, shasum of the given path FindFileShasum(path string) (shasum string, err error) // FindFileSha256 returns the given path's sha256 byte hash, base64 encoded FindFileSha256(path string) (shasum string, err error) // FindFileMime returns the mime type of the given path FindFileMime(path string) (mime string, err error) // ListFiles returns the list of files in the specified directory path ListFiles(path string) (files []string) // ListAllFiles returns the recursive list of all files at the specified directory path ListAllFiles(path string) (files []string) // ListDirs returns the list of directories in the specified directory path ListDirs(path string) (dirs []string) // ListAllDirs returns the recursive list of all files at the specified directory path ListAllDirs(path string) (dirs []string) }
type WrapFileSystem ¶
type WrapFileSystem struct {
// contains filtered or unexported fields
}
func (WrapFileSystem) CloneROFS ¶ added in v0.2.5
func (w WrapFileSystem) CloneROFS() (cloned FileSystem)
func (WrapFileSystem) Exists ¶
func (w WrapFileSystem) Exists(path string) (exists bool)
func (WrapFileSystem) FileCreated ¶
func (w WrapFileSystem) FileCreated(path string) (created int64, err error)
func (WrapFileSystem) FindFilePath ¶ added in v0.2.0
func (w WrapFileSystem) FindFilePath(prefix string, extensions ...string) (path string, err error)
func (WrapFileSystem) ID ¶ added in v0.2.11
func (w WrapFileSystem) ID() (id string)
func (WrapFileSystem) LastModified ¶
func (w WrapFileSystem) LastModified(path string) (updated int64, err error)
func (WrapFileSystem) ListAllDirs ¶
func (w WrapFileSystem) ListAllDirs(path string) (paths []string, err error)
func (WrapFileSystem) ListAllFiles ¶
func (w WrapFileSystem) ListAllFiles(path string) (paths []string, err error)
func (WrapFileSystem) ListDirs ¶
func (w WrapFileSystem) ListDirs(path string) (paths []string, err error)
func (WrapFileSystem) ListFiles ¶
func (w WrapFileSystem) ListFiles(path string) (paths []string, err error)
func (WrapFileSystem) MimeType ¶
func (w WrapFileSystem) MimeType(path string) (mime string, err error)
func (WrapFileSystem) Name ¶
func (w WrapFileSystem) Name() (name string)
func (WrapFileSystem) ReadDir ¶
func (w WrapFileSystem) ReadDir(path string) (entries []fs.DirEntry, err error)
func (WrapFileSystem) ReadFile ¶
func (w WrapFileSystem) ReadFile(path string) (data []byte, err error)
func (WrapFileSystem) ReadPageMatter ¶ added in v0.2.0
func (w WrapFileSystem) ReadPageMatter(path string) (pm *matter.PageMatter, err error)
type WrapRWFileSystem ¶ added in v0.1.0
type WrapRWFileSystem struct { WrapFileSystem // contains filtered or unexported fields }
func (WrapRWFileSystem) BeginTransaction ¶ added in v0.2.5
func (w WrapRWFileSystem) BeginTransaction()
func (WrapRWFileSystem) ChangeTimes ¶ added in v0.5.0
func (w WrapRWFileSystem) ChangeTimes(path string, created, updated time.Time) (err error)
func (WrapRWFileSystem) CloneRWFS ¶ added in v0.2.5
func (w WrapRWFileSystem) CloneRWFS() (cloned RWFileSystem)
func (WrapRWFileSystem) CommitTransaction ¶ added in v0.2.5
func (w WrapRWFileSystem) CommitTransaction()
func (WrapRWFileSystem) EndTransaction ¶ added in v0.2.5
func (w WrapRWFileSystem) EndTransaction()
func (WrapRWFileSystem) ID ¶ added in v0.2.11
func (w WrapRWFileSystem) ID() (id string)
func (WrapRWFileSystem) MakeDir ¶ added in v0.1.0
func (w WrapRWFileSystem) MakeDir(path string, perm os.FileMode) (err error)
func (WrapRWFileSystem) MakeDirAll ¶ added in v0.1.0
func (w WrapRWFileSystem) MakeDirAll(path string, perm os.FileMode) (err error)
func (WrapRWFileSystem) Remove ¶ added in v0.1.0
func (w WrapRWFileSystem) Remove(path string) (err error)
func (WrapRWFileSystem) RemoveAll ¶ added in v0.1.0
func (w WrapRWFileSystem) RemoveAll(path string) (err error)
func (WrapRWFileSystem) RemovePageMatter ¶ added in v0.2.0
func (w WrapRWFileSystem) RemovePageMatter(path string) (err error)
func (WrapRWFileSystem) RollbackTransaction ¶ added in v0.2.5
func (w WrapRWFileSystem) RollbackTransaction()
func (WrapRWFileSystem) WritePageMatter ¶ added in v0.2.0
func (w WrapRWFileSystem) WritePageMatter(pm *matter.PageMatter) (err error)
Click to show internal directories.
Click to hide internal directories.