filesystem

package
v0.0.0-...-6c8496d Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmbedSchema = "embed"
)

Variables

This section is empty.

Functions

func CopyFromFS

func CopyFromFS(root, dest string, fsys Filesystem) (err error)

CopyFromFS copies files from the `src` dir on the accessor Filesystem to local filesystem into `dest` dir. The src path uses slashes as their separator. The dest path uses OS specific separator.

func NewMaskingFS

func NewMaskingFS(masked func(path string) bool, fs Filesystem) maskingFS

func NewOsFilesystem

func NewOsFilesystem(root string) osFilesystem

func NewSubFS

func NewSubFS(root string, fs Filesystem) subFS

func NewZipFS

func NewZipFS(archive *zip.Reader) zipFS

Types

type BillyFilesystem

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

BillyFilesystem is a template file accessor backed by a billy FS

func NewBillyFilesystem

func NewBillyFilesystem(fs billy.Filesystem) BillyFilesystem

func (BillyFilesystem) Open

func (b BillyFilesystem) Open(name string) (fs.File, error)

func (BillyFilesystem) ReadDir

func (b BillyFilesystem) ReadDir(name string) ([]fs.DirEntry, error)
func (b BillyFilesystem) Readlink(link string) (string, error)

func (BillyFilesystem) Stat

func (b BillyFilesystem) Stat(name string) (fs.FileInfo, error)

type Filesystem

type Filesystem interface {
	fs.ReadDirFS
	fs.StatFS
	Readlink(link string) (string, error)
}

Filesystems Wrap the implementations of FS with their subtle differences into the common interface for accessing template files defined herein. os: standard for on-disk extensible template repositories. zip: embedded filesystem backed by the byte array representing zipfile. billy: go-git library's filesystem used for remote git template repos.

type UnionFS

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

UnionFS is an os.FS and embed.FS union fs. Files in embed.FS has the header "embed://", and files in os.FS don't have this header.

func NewUnionFS

func NewUnionFS(embedFS embed.FS) UnionFS

func (UnionFS) Open

func (u UnionFS) Open(name string) (fs.File, error)

func (UnionFS) ReadDir

func (u UnionFS) ReadDir(name string) ([]fs.DirEntry, error)

func (UnionFS) ReadFile

func (u UnionFS) ReadFile(name string) ([]byte, error)
func (u UnionFS) Readlink(link string) (string, error)

func (UnionFS) Stat

func (u UnionFS) Stat(name string) (fs.FileInfo, error)

Jump to

Keyboard shortcuts

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