func (driver *QiniuDriver) GetFile(key string, offset int64) (int64, io.ReadCloser, error) { stat, err := driver.Stat(key) if err != nil { return 0, nil, err } key = strings.TrimLeft(key, "/") domain := fmt.Sprintf("%s.qiniudn.com", driver.bucket) baseUrl := rs.MakeBaseUrl(domain, key) policy := rs.GetPolicy{} downUrl := policy.MakeRequest(baseUrl, nil) resp, err := http.Get(downUrl) if err != nil { return 0, nil, err } return stat.Size(), NewSkipReadCloser(resp.Body, offset), nil }
// @gist downloadUrl func downloadUrl(domain, key string) string { baseUrl := rs.MakeBaseUrl(domain, key) policy := rs.GetPolicy{} return policy.MakeRequest(baseUrl, nil) }