Documentation ¶
Index ¶
- type Client
- func (c *Client) Delete(remotes ...string) error
- func (c *Client) DeleteWithContext(ctx context.Context, remotes ...string) error
- func (c *Client) Download(remote string, respBody io.Writer) (*Request, error)
- func (c *Client) DownloadAsync(remote string, respBody io.Writer) (*Request, error)
- func (c *Client) DownloadAsyncWithContext(ctx context.Context, remote string, respBody io.Writer) (*Request, error)
- func (c *Client) DownloadWithContext(ctx context.Context, remote string, respBody io.Writer) (*Request, error)
- func (c *Client) Exists(remote string) (bool, *Request, error)
- func (c *Client) ExistsWithContext(ctx context.Context, remote string) (exists bool, req *Request, err error)
- func (c *Client) List(prefix string, recursive bool) (ListResult, error)
- func (c *Client) ListWithContext(ctx context.Context, prefix string, recursive bool) (result ListResult, err error)
- func (c *Client) URL(remote string) string
- func (c *Client) Upload(remote string, reqBody io.Reader, reqBodyMd5 []byte, contentType string) (*Request, error)
- func (c *Client) UploadWithContext(ctx context.Context, remote string, reqBody io.Reader, reqBodyMd5 []byte, ...) (*Request, error)
- type Directory
- type File
- type ListResult
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
An OSS client must have prefix, bucket, access key ID and access key secret. Prefix should be a string like this: https://<your-bucket>.<region>.aliyuncs.com.
func (*Client) DeleteWithContext ¶ added in v1.1.0
Delete creates and executes a delete request for multiple remote keys (paths) at the same time.
func (*Client) DownloadAsync ¶
DownloadAsync wraps DownloadAsyncWithContext using context.Background.
func (*Client) DownloadAsyncWithContext ¶ added in v1.1.0
func (c *Client) DownloadAsyncWithContext(ctx context.Context, remote string, respBody io.Writer) (*Request, error)
DownloadAsync is like Download but won't wait till download is complete.
func (*Client) DownloadWithContext ¶ added in v1.1.0
func (c *Client) DownloadWithContext(ctx context.Context, remote string, respBody io.Writer) (*Request, error)
Download creates and executes a download request from remote path to respBody (io.Writer), returns the request and error. You can use bytes.Buffer to download the file to memory. If you want to have more than one destination, use io.MultiWriter.
func (*Client) ExistsWithContext ¶ added in v1.1.0
func (*Client) List ¶
func (c *Client) List(prefix string, recursive bool) (ListResult, error)
List wraps ListWithContext using context.Background.
func (*Client) ListWithContext ¶ added in v1.1.0
func (c *Client) ListWithContext(ctx context.Context, prefix string, recursive bool) (result ListResult, err error)
List creates and executes a list request for remote files and directories under prefix, recursively if recursive is set to true.
func (*Client) Upload ¶
func (c *Client) Upload(remote string, reqBody io.Reader, reqBodyMd5 []byte, contentType string) (*Request, error)
Upload wraps UploadWithContext using context.Background.
func (*Client) UploadWithContext ¶ added in v1.1.0
func (c *Client) UploadWithContext(ctx context.Context, remote string, reqBody io.Reader, reqBodyMd5 []byte, contentType string) (*Request, error)
Upload creates and executes a upload request for reqBody (io.Reader) to remote path, returns the request and error. reqBodyMd5 can be nil, OSS will run MD5 check if it is provided. If contentType is empty, "application/octet-stream" will be used. If the body is bytes, use bytes.NewReader. If it is a string, use strings.NewReader.