Documentation
¶
Index ¶
- Constants
- Variables
- func DownloadFile(localFile string, file http.File) (err error)
- func IsOffline(fs http.FileSystem) bool
- func IsRemote(mode fs.FileMode) bool
- func New(local string, remote Remote, offline ...bool) http.FileSystem
- func NewEx(local string, remote Remote, offline ...bool) (_ http.FileSystem, err error)
- type Remote
Constants ¶
View Source
const ( // ModeRemote indicates that the file is a remote file or directory. ModeRemote = fs.ModeSymlink | fs.ModeIrregular )
Variables ¶
View Source
var ( // ErrOffline indicates that the remote filesystem is offline. ErrOffline = errors.New("remote filesystem is offline") )
Functions ¶
func DownloadFile ¶
DownloadFile downloads the file from the remote to the local cache file.
func IsOffline ¶
func IsOffline(fs http.FileSystem) bool
IsOffline checks if the cached file system is in offline mode.
Types ¶
type Remote ¶
type Remote interface {
// Init initializes the remote file system with it local cache.
Init(local string, offline bool) error
// Lstat retrieves the cached FileInfo for the specified file or directory.
Lstat(localFile string) (fs.FileInfo, error)
// ReaddirAll reads all entries in the directory and returns their cached FileInfo.
ReaddirAll(localDir string, dir *os.File, offline bool) (fis []fs.FileInfo, err error)
// SyncLstat retrieves the FileInfo from the remote.
SyncLstat(local string, name string) (fs.FileInfo, error)
// SyncOpen retrieves the file from the remote.
SyncOpen(local string, name string, fi fs.FileInfo) (http.File, error)
}
Remote is an interface for remote file system operations.
Click to show internal directories.
Click to hide internal directories.