Documentation
¶
Index ¶
- func Download(destFile string, src http.File) (err error)
- func File(name string, r ContentReader) http.File
- func Files(files ...string) http.FileSystem
- func FilesWithContent(files ...string) http.FileSystem
- func HttpFile(name string, resp *http.Response) http.File
- func LocalCheck(fsys http.FileSystem) (string, bool)
- func Parent(parentDir string, fs http.FileSystem) http.FileSystem
- func Plugins(fs http.FileSystem, plugins ...interface{}) http.FileSystem
- func Root() http.FileSystem
- func SequenceFile(name string, body io.ReadCloser) http.File
- func Sub(fs http.FileSystem, subDir string) http.FileSystem
- func Union(fs ...http.FileSystem) http.FileSystem
- func Unseekable(file http.File) io.ReadCloser
- func WithTracker(fs http.FileSystem, trackerInit interface{}, exts ...string) http.FileSystem
- type ContentReader
- type DirInfo
- type FileInfo
- type HttpFS
- type HttpOpener
- type Plugin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func File ¶ added in v1.12.3
func File(name string, r ContentReader) http.File
File implements a http.File by a ContentReader which may implement optional interface{ ModTime() time.Time } and io.Closer.
func Files ¶
func Files(files ...string) http.FileSystem
Files implements a http.FileSystem by a list of file name and content file.
func FilesWithContent ¶
func FilesWithContent(files ...string) http.FileSystem
FilesWithContent implements a http.FileSystem by a list of file name and content.
func LocalCheck ¶ added in v1.13.0
func LocalCheck(fsys http.FileSystem) (string, bool)
LocalCheck checks a FileSystem is local or not.
func Parent ¶ added in v1.13.0
func Parent(parentDir string, fs http.FileSystem) http.FileSystem
Parent returns a FileSystem that fs is located in the `parentDir` directory.
func Plugins ¶ added in v1.12.5
func Plugins(fs http.FileSystem, plugins ...interface{}) http.FileSystem
Plugins implements a filesystem with plugins by specified (ext string, plugin Plugin) pairs.
func Root ¶ added in v1.12.1
func Root() http.FileSystem
Root implements a http.FileSystem that only have a root directory.
func SequenceFile ¶ added in v1.12.5
func SequenceFile(name string, body io.ReadCloser) http.File
SequenceFile implements a http.File by a io.ReadCloser object.
func Sub ¶ added in v1.13.0
func Sub(fs http.FileSystem, subDir string) http.FileSystem
Sub returns a FileSystem corresponding to the subtree rooted at fs's subDir.
func Union ¶
func Union(fs ...http.FileSystem) http.FileSystem
Union merge a list of http.FileSystem into a union http.FileSystem object.
func Unseekable ¶ added in v1.12.10
func Unseekable(file http.File) io.ReadCloser
Unseekable convert a http.File into a io.ReadCloser object without io.Seeker. Note you should stop using the origin http.File object to read data. This method is used to reduce unnecessary memory usage.
func WithTracker ¶ added in v1.12.3
func WithTracker(fs http.FileSystem, trackerInit interface{}, exts ...string) http.FileSystem
WithTracker implements a http.FileSystem by pactching large file access like git lfs. Here trackerInit should be (urlBase string) or (httpfs *fs.HttpFS).
Types ¶
type ContentReader ¶ added in v1.12.3
type DirInfo ¶ added in v1.12.13
type DirInfo struct {
// contains filtered or unexported fields
}
DirInfo describes a single directory in an file system. It implements fs.FileInfo and io.Closer and Stat().
func NewDirInfo ¶ added in v1.12.13
NewDirInfo creates a DirInfo that describes a single directory in an file system. It implements fs.FileInfo and io.Closer and Stat().
type FileInfo ¶ added in v1.12.13
FileInfo describes a single file in an file system. It implements fs.FileInfo and fs.DirEntry.
func NewFileInfo ¶ added in v1.12.13
NewFileInfo creates a FileInfo that describes a single file in an file system. It implements fs.FileInfo and fs.DirEntry.
type HttpFS ¶ added in v1.12.8
type HttpFS struct { HttpOpener // contains filtered or unexported fields }
func Http ¶ added in v1.12.6
Http creates a HttpFS which implements a http.FileSystem by http.Get join(urlBase, name).