Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) AsyncDownloader(ctx context.Context, dir string, fileDlQueue <-chan *slack.File) (chan struct{}, error)
- func (c *Client) DownloadFile(dir string, f slack.File) error
- func (c *Client) SaveFile(ctx context.Context, dir string, f *slack.File) (int64, error)
- func (c *Client) Start(ctx context.Context)
- func (c *Client) Stop()
- type Downloader
- type FileRequest
- type Option
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotStarted = errors.New("downloader not started")
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AsyncDownloader ¶
func (c *Client) AsyncDownloader(ctx context.Context, dir string, fileDlQueue <-chan *slack.File) (chan struct{}, error)
AsyncDownloader starts Client.worker goroutines to download files concurrently. It will download any file that is received on fileDlQueue channel. It returns the "done" channel and an error. "done" channel will be closed once all downloads are complete.
func (*Client) DownloadFile ¶
DownloadFile requires a started downloader, otherwise it will return ErrNotStarted. Will place the file to the download queue, and save the file to the directory that was specified when Start was called. If the file buffer is full, will block until it becomes empty.
type Downloader ¶
type Downloader interface { // GetFile retreives a given file from its private download URL GetFile(downloadURL string, writer io.Writer) error }
Downloader is the file downloader interface. It exists primarily for mocking in tests.
type FileRequest ¶
Click to show internal directories.
Click to hide internal directories.