Documentation
¶
Index ¶
- type FS
- type FSWithReadWriteAt
- type LocalFS
- func (FS *LocalFS) CheckDir(dirName string) (err error)
- func (FS *LocalFS) Dir(dirName string) ([]string, []os.FileInfo, error)
- func (FS *LocalFS) File(fileName string, access int) (*os.File, error)
- func (FS *LocalFS) FileRead(fileName string, access int) (io.ReaderAt, error)
- func (FS *LocalFS) FileWrite(fileName string, access int) (io.WriterAt, error)
- func (FS *LocalFS) GetFS() fs.FS
- func (FS *LocalFS) Link(fileName string, target string) (err error)
- func (FS *LocalFS) Lstat(fileName string) (string, fs.FileInfo, error)
- func (FS *LocalFS) MakeDir(folderName string) error
- func (FS *LocalFS) ModifyTime(filePath string, newTime string) (err error)
- func (FS *LocalFS) ReadFile(name string, w io.Writer) (int64, error)
- func (FS *LocalFS) Remove(fileName string) (err error)
- func (FS *LocalFS) Rename(fileName, newName string) (err error)
- func (FS *LocalFS) RootDir() string
- func (FS *LocalFS) SetStat(fileName string, newPermission os.FileMode) error
- func (FS *LocalFS) Stat(fileName string) (string, fs.FileInfo, error)
- func (FS *LocalFS) StatFS(path string) (*sftp.StatVFS, error)
- func (FS *LocalFS) Symlink(fileName string, target string) (err error)
- func (FS *LocalFS) WriteFile(fileName string, r io.Reader, transferType string, appendOnly bool) error
- type NewFS
- type NewFSWithReadWriteAt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FS ¶
type FS interface {
// RootDir returns the Root directory of the file system
RootDir() string
// Dir returns a list of files in the given directory
Dir(folderName string) ([]string, []os.FileInfo, error)
// CheckDir checks if the given directory exists
CheckDir(string) error
// MakeDir creates a new directory with the given name
MakeDir(folderName string) error
// ReadFile reads the file and writes it to the given writer
ReadFile(string, io.Writer) (int64, error)
// WriteFile creates a new file with the given name and writes the data from the reader
// filename is the name of the file to create
// r is the reader that contains the data to write to the file
// transferType is the transfer type "A" for ASCII or "I" for binary
// appendOnly is true if the file should be opened in append mode not rewrite mode
WriteFile(fileName string, r io.Reader, transferType string, appendOnly bool) error
// Remove removes the file
// fileName is the name of the file to remove
Remove(fileName string) error
// Rename renames the file/folder or moves it to a different directory
Rename(original string, target string) error
// ModifyTime changes the file modification time
ModifyTime(string, string) error
// Stat returns the file info without following the link
Stat(fileName string) (string, fs.FileInfo, error)
// SetStat changes the file info
SetStat(fileName string, newPermissions os.FileMode) error
// Lstat returns the file info without following the link
Lstat(fileName string) (string, fs.FileInfo, error)
// Link creates a hard link pointing to a file.
Link(fileName string, target string) error
// Symlink creates a symbolic link pointing to a file or directory.
Symlink(fileName string, target string) error
}
FS is filesystem the interface that wraps the basic methods for a FTP,FTPS,SFTP file system The FTP server uses this interface to interact with the file system CheckDir checks if the given directory exists RootDir returns the Root directory of the file system Dir returns a list of files in the given directory Read reads the file and writes it to the given writer Create creates a new file with the given name and writes the data from the reader Remove removes the file/directory Rename renames the file/directory or moves it to a different directory Stat returns the file info SetStat changes the file info Lstat returns the file info without following the link Link creates a hard link pointing to a file. Symlink creates a symbolic link pointing to a file or directory.
type FSWithReadWriteAt ¶
type FSWithReadWriteAt interface {
FS
// FileWrite creates/update a new file with the given name and writes the data from the reader
FileWrite(fileName string, access int) (io.WriterAt, error)
// FileRead reads the file at the given offset and writes it to the given writer
FileRead(fileName string, access int) (io.ReaderAt, error)
// StatFS FileStatFS returns the file system status of the file system containing the file
StatFS(path string) (*sftp.StatVFS, error)
}
FSWithReadWriteAt is the interface that wraps the basic methods for a SFTP file system
type LocalFS ¶
LocalFS is a local file system that implements the FtpFS interface
func NewLocalFS ¶
func (*LocalFS) ModifyTime ¶
ModifyTime changes the file modification time
func (*LocalFS) StatFS ¶
StatFS FileStatFS returns the file system status of the file system containing the file
type NewFSWithReadWriteAt ¶
type NewFSWithReadWriteAt interface {
NewFS
FSWithReadWriteAt
}
NewFSWithReadWriteAt implement the FSWithFile interface add support for the New 1.16 fs.FS interface