Documentation ¶
Overview ¶
Package dropy implements a higher-level Dropbox API on top of go-dropbox.
Example ¶
Upload and read a file.
token := env.MustGet("DROPBOX_ACCESS_TOKEN") client := dropy.New(dropbox.New(dropbox.NewConfig(token))) client.Upload("/demo.txt", strings.NewReader("Hello World")) io.Copy(os.Stdout, client.Open("/demo.txt"))
Output: Hello World
Index ¶
- type Client
- func (c *Client) Copy(src, dst string) error
- func (c *Client) Delete(name string) error
- func (c *Client) Download(name string) (io.ReadCloser, error)
- func (c *Client) List(name string) ([]os.FileInfo, error)
- func (c *Client) ListFiles(name string) ([]os.FileInfo, error)
- func (c *Client) ListFilter(name string, filter func(info os.FileInfo) bool) (ret []os.FileInfo, err error)
- func (c *Client) ListFolders(name string) ([]os.FileInfo, error)
- func (c *Client) ListN(name string, n int) (list []os.FileInfo, err error)
- func (c *Client) Mkdir(name string) error
- func (c *Client) Move(src, dst string) error
- func (c *Client) Open(name string) *File
- func (c *Client) Preview(name string) (io.ReadCloser, error)
- func (c *Client) Read(name string) ([]byte, error)
- func (c *Client) Search(path, query string) (list []os.FileInfo, err error)
- func (c *Client) Stat(name string) (os.FileInfo, error)
- func (c *Client) Upload(path string, r io.Reader) error
- type File
- type FileInfo
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
*dropbox.Client
}
Client wraps dropbox.Client to provide higher level sugar.
func (*Client) Download ¶
func (c *Client) Download(name string) (io.ReadCloser, error)
Download returns the contents of `name`.
func (*Client) ListFilter ¶
func (c *Client) ListFilter(name string, filter func(info os.FileInfo) bool) (ret []os.FileInfo, err error)
ListFilter returns all entries in dir `name` filtered by `filter`.
func (*Client) ListFolders ¶
ListFolders returns all folders in dir `name`.
func (*Client) ListN ¶
ListN returns entries in dir `name`. Up to `n` entries, or all when `n` <= 0.
func (*Client) Preview ¶
func (c *Client) Preview(name string) (io.ReadCloser, error)
Preview returns the PDF preview of `name`.
type File ¶
type File struct { Name string // contains filtered or unexported fields }
File implements an io.ReadWriteCloser for Dropbox files.
Click to show internal directories.
Click to hide internal directories.