filesystem

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NameOsfs = "OsFs"
)
View Source
const (
	NameSftpfs = "sftpfs"
)

Variables

This section is empty.

Functions

func CleanPath

func CleanPath(fs afero.Fs, path string) string

func NewOsFs

func NewOsFs() afero.Fs

func NewSftpFs

func NewSftpFs(host string, port int, username, password string) (afero.Fs, error)

func NormalizeDir

func NormalizeDir(name string, client *sftp.Client) (string, error)

func Walk

func Walk(fs afero.Fs, root string, walkFn filepath.WalkFunc) error

Types

type File

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

func FileCreate

func FileCreate(s *sftp.Client, name string) (*File, error)

func FileOpen

func FileOpen(s *sftp.Client, name string) (*File, error)

func (*File) Close

func (f *File) Close() error

func (*File) Name

func (f *File) Name() string

func (*File) Read

func (f *File) Read(b []byte) (n int, err error)

func (*File) ReadAt

func (f *File) ReadAt(b []byte, off int64) (n int, err error)

TODO

func (*File) Readdir

func (f *File) Readdir(count int) (res []os.FileInfo, err error)

TODO

func (*File) Readdirnames

func (f *File) Readdirnames(n int) (names []string, err error)

TODO

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (int64, error)

func (*File) Stat

func (f *File) Stat() (os.FileInfo, error)

func (*File) Sync

func (f *File) Sync() error

func (*File) Truncate

func (f *File) Truncate(size int64) error

func (*File) Write

func (f *File) Write(b []byte) (n int, err error)

func (*File) WriteAt

func (f *File) WriteAt(b []byte, off int64) (n int, err error)

TODO

func (*File) WriteString

func (f *File) WriteString(s string) (ret int, err error)

type OsFs

type OsFs struct {
	afero.Fs
}

func (OsFs) Chmod

func (OsFs) Chmod(name string, mode os.FileMode) error

func (OsFs) Chtimes

func (OsFs) Chtimes(name string, atime time.Time, mtime time.Time) error

func (OsFs) Close

func (OsFs) Close()

func (OsFs) Create

func (OsFs) Create(name string) (afero.File, error)

func (OsFs) Mkdir

func (OsFs) Mkdir(name string, perm os.FileMode) error

func (OsFs) MkdirAll

func (OsFs) MkdirAll(path string, perm os.FileMode) error

func (OsFs) Name

func (OsFs) Name() string

func (OsFs) Open

func (OsFs) Open(name string) (afero.File, error)

func (OsFs) OpenFile

func (OsFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)

func (OsFs) Remove

func (OsFs) Remove(name string) error

func (OsFs) RemoveAll

func (OsFs) RemoveAll(path string) error

func (OsFs) Rename

func (OsFs) Rename(oldname, newname string) error

func (OsFs) Stat

func (OsFs) Stat(name string) (os.FileInfo, error)

type SftpFs

type SftpFs struct {
	// *io.Closer
	afero.Fs

	Context *SftpFsContext
	// contains filtered or unexported fields
}

Fs is a afero.Fs implementation that uses functions provided by the sftp package.

For details in any method, check the documentation of the sftp package (github.com/pkg/sftp).

func (SftpFs) Chmod

func (s SftpFs) Chmod(name string, mode os.FileMode) error

func (SftpFs) Chtimes

func (s SftpFs) Chtimes(name string, atime time.Time, mtime time.Time) error

func (SftpFs) Close

func (s SftpFs) Close()

func (SftpFs) Create

func (s SftpFs) Create(name string) (afero.File, error)

func (SftpFs) Lstat

func (s SftpFs) Lstat(p string) (os.FileInfo, error)

func (SftpFs) Mkdir

func (s SftpFs) Mkdir(name string, perm os.FileMode) error

func (SftpFs) MkdirAll

func (s SftpFs) MkdirAll(path string, perm os.FileMode) error

func (SftpFs) Name

func (s SftpFs) Name() string

func (SftpFs) Open

func (s SftpFs) Open(name string) (afero.File, error)

func (SftpFs) OpenFile

func (s SftpFs) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)

changed!!!

func (SftpFs) Remove

func (s SftpFs) Remove(name string) error

func (SftpFs) RemoveAll

func (s SftpFs) RemoveAll(path string) error

func (SftpFs) Rename

func (s SftpFs) Rename(oldname, newname string) error

func (SftpFs) Stat

func (s SftpFs) Stat(name string) (os.FileInfo, error)

type SftpFsContext

type SftpFsContext struct {
	SftpClient *sftp.Client
	// contains filtered or unexported fields
}

func NewSftpFsContext

func NewSftpFsContext(user, password, host string) (*SftpFsContext, error)

func (*SftpFsContext) Close

func (ctx *SftpFsContext) Close() error

Jump to

Keyboard shortcuts

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