Documentation
¶
Index ¶
- type Client
- func (c *Client) BaseDir() string
- func (c *Client) Copy(ctx context.Context, dst string, src string) (n int64, err error)
- func (c *Client) CopyTo(ctx context.Context, p string, r io.Reader) (n int64, err error)
- func (c *Client) Dir(ctx context.Context, p string) (fs.DirIterator, error)
- func (c *Client) Download(ctx context.Context, p string) (fs.Reader, error)
- func (c *Client) DownloadMetadata(ctx context.Context, p string) (*fs.Metadata, error)
- func (c *Client) Exists(ctx context.Context, p string) (bool, error)
- func (c *Client) IsDir(ctx context.Context, p string) (bool, error)
- func (c *Client) IsDirEmpty(ctx context.Context, p string) (bool, error)
- func (c *Client) IsFile(ctx context.Context, p string) (bool, error)
- func (c *Client) Mkdir(ctx context.Context, p string) error
- func (c *Client) MkdirRecursive(ctx context.Context, p string) error
- func (c *Client) Remove(ctx context.Context, p string) error
- func (c *Client) RemoveAll(ctx context.Context, p string) error
- func (c *Client) RemoveFile(ctx context.Context, p string) error
- func (c *Client) ReplaceFile(ctx context.Context, p string) (fs.Writer, error)
- func (c *Client) Rmdir(ctx context.Context, p string) error
- func (c *Client) Upload(ctx context.Context, p string) (fs.Writer, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements fs.Interface for the filesystem.
func (*Client) Copy ¶
Copy copies the contents of the file at src to dst. If src does not exist or is not a file, then fs/errors.NotExist is returned. If dst's parent directory does not exist, an fs/errors.NotExist error is returned; if the parent exists but is not a directory then an fs/errors.NotDirectory error is returned; an fs/errors.Exist error is returned if a file or directory with path dst already exists. Returns the number of bytes copied.
func (*Client) CopyTo ¶
CopyTo copies the contents of r to p. If p's parent directory does not exist, an fs/errors.NotExist error is returned; if the parent exists but is not a directory then an fs/errors.NotDirectory error is returned; an fs/errors.Exist error is returned if a file or directory with path p already exists. Returns the number of bytes copied.
func (*Client) Dir ¶
Dir returns an iterator containing metadata for the files and directories within the directory with path p. If the path p does not exist then an fs/errors.NotExist error is returned; if the path p exists but is not a directory then an fs/errors.NotDirectory error will be returned. It is the caller's responsibility to call Close on the returned fs.DirIterator, otherwise resources may leak.
func (*Client) Download ¶
Download returns a Reader reading from contents of the file with the path p. If no file with path p exists, an fs/errors.NotFile is returned. It is the caller's responsibility to call Close on the returned Reader, otherwise resources may leak.
func (*Client) DownloadMetadata ¶
DownloadMetadata returns the metadata for the file or directory with the path p. If a file or directory with this path does not exist, an fs/errors.NotExist error is returned.
func (*Client) IsDirEmpty ¶
IsDirEmpty returns true if and only if path p exists and is an empty directory. If the path is not a directory, returns fs/errors.NotDirectory.
func (*Client) Mkdir ¶
Mkdir creates the directory with the path p. If p's parent directory does not exist, an fs/errors.NotExist error is returned; if the parent exists but is not a directory then an fs/errors.NotDirectory error is returned; if a file or directory with that path already exists then an fs/errors.Exist error is returned.
func (*Client) MkdirRecursive ¶
MkdirRecursive creates the directory with the given path p, along with any intermediate directories as necessary. An fs/errors.Exist error is returned if a file or directory with that path already exists, or if a file already exists with an intermediate path.
func (*Client) Remove ¶
Remove attempts to remove the file or directory with the path p. If the path does not exist, an fs/errors.NotExist error is returned. If the path is a directory and is non-empty or is "/", an fs/errors.DirNotEmpty error is returned.
func (*Client) RemoveAll ¶
RemoveAll removes path p if p is a file, and removes p and all its contents if p is a directory. If the path does not exist, RemoveAll returns nil (no error).
func (*Client) RemoveFile ¶
RemoveFile attempts to delete the file with path p. If p does not exist or is not a file, then the error errors.NotFile will be returned.
func (*Client) ReplaceFile ¶
ReplaceFile attempts to create or replace the file with path p. If p's parent directory does not exist, an errors.NotExist error is returned; if the parent exists but is not a directory then an errors.NotDirectory error is returned; if p exists but is not a file, then the error errors.NotFile will be returned. It is the caller's responsibility to call Close on the returned Writer, otherwise resources may leak.
func (*Client) Rmdir ¶
Rmdir removes the path p, if p is an empty directory. If the path is not a directory, returns fs/errors.NotDirectory; if the directory is not empty or is "/", returns fs/errors.DirNotEmpty.
func (*Client) Upload ¶
Upload returns a Writer writing to the path p. If p's parent directory does not exist, an fs/errors.NotExist error is returned; if the parent exists but is not a directory then an fs/errors.NotDirectory error is returned; if a file or directory with path p already exists then an fs/errors.Exist error is returned. It is the caller's responsibility to call Close on the returned Writer, otherwise resources may leak.