Documentation
¶
Overview ¶
Package dropbox provides an afero implementation to the dropbox API
Index ¶
- Variables
- type File
- func (f *File) Close() error
- func (f *File) Name() string
- func (f *File) Read(p []byte) (int, error)
- func (f *File) ReadAt(p []byte, off int64) (n int, err error)
- func (f *File) Readdir(count int) ([]os.FileInfo, error)
- func (f *File) Readdirnames(n int) ([]string, error)
- func (f *File) Seek(offset int64, whence int) (int64, error)
- func (f *File) Stat() (os.FileInfo, error)
- func (f *File) Sync() error
- func (f *File) Truncate(size int64) error
- func (f *File) Write(p []byte) (n int, err error)
- func (f *File) WriteAt(p []byte, off int64) (n int, err error)
- func (f *File) WriteString(s string) (ret int, err error)
- type FileInfo
- type Fs
- func (fs *Fs) Chmod(name string, mode os.FileMode) error
- func (fs *Fs) Chown(name string, uid int, gid int) error
- func (fs *Fs) Chtimes(name string, _ time.Time, mtime time.Time) error
- func (fs *Fs) Create(name string) (afero.File, error)
- func (fs *Fs) Mkdir(name string, _ os.FileMode) error
- func (fs *Fs) MkdirAll(name string, perm os.FileMode) error
- func (fs *Fs) Name() string
- func (fs *Fs) Open(name string) (afero.File, error)
- func (fs *Fs) OpenFile(name string, flag int, _ os.FileMode) (afero.File, error)
- func (fs *Fs) Remove(name string) error
- func (fs *Fs) RemoveAll(name string) error
- func (fs *Fs) Rename(oldname, newname string) error
- func (fs *Fs) SetRootDirectory(fullPath string)
- func (fs *Fs) Stat(name string) (os.FileInfo, error)
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyOpened = errors.New("already opened")
ErrAlreadyOpened is returned when the file is already opened.
var ErrInvalidSeek = errors.New("invalid seek offset")
ErrInvalidSeek is returned when the seek operation is not doable.
var ErrNotSupported = errors.New("dropbox doesn't support this operation")
ErrNotSupported is returned when this operations is not supported by S3.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents a file structure.
func (*File) Close ¶
Close closes the File, rendering it unusable for I/O. It returns an error, if any.
func (*File) Read ¶
Read reads up to len(b) bytes from the File. It returns the number of bytes read and an error, if any. EOF is signaled by a zero count with err set to io.EOF.
func (*File) ReadAt ¶
ReadAt reads len(p) bytes from the file starting at byte offset off. It returns the number of bytes read and the error, if any. ReadAt always returns a non-nil error when n < len(b). At end of file, that error is io.EOF.
func (*File) Readdir ¶
Readdir lists all the files of a directory. Unfortunately the dropbox API doesn't allow to limit the number of returned files per call. so what we're doing here is to using a channel a temporary buffer.
func (*File) Readdirnames ¶
Readdirnames reads and returns a slice of names from the directory f.
func (*File) Seek ¶
Seek sets the offset for the next Read or Write on file to offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end. It returns the new offset and an error, if any. The behavior of Seek on a file opened with O_APPEND is not specified.
func (*File) Truncate ¶
Truncate should truncate a file to a specific size but isn't supported by dropbox.
func (*File) Write ¶
Write writes len(b) bytes to the File. It returns the number of bytes written and an error, if any. Write returns a non-nil error when n != len(b).
type FileInfo ¶
type FileInfo struct {
// contains filtered or unexported fields
}
FileInfo is dropbox file description.
type Fs ¶
type Fs struct {
// contains filtered or unexported fields
}
Fs is the dropbox filesystem.
func (*Fs) Chtimes ¶
Chtimes is not supported because dropbox doesn't support simply changing a time.
func (*Fs) Create ¶
Create creates a file. This implementation respects the afero specs but is super slow because it will always open the file two times.
func (*Fs) SetRootDirectory ¶
SetRootDirectory defines a base directory This is mostly useful to isolate tests and can most probably forgotten for most use-cases.