-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from creaplus/feature/add_r2_support
Feature/add r2 support
- Loading branch information
Showing
6 changed files
with
358 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Cloudflare R2 | ||
|
||
[Cloudflare R2](https://developers.cloudflare.com/r2/) | ||
|
||
## Usage | ||
|
||
```go | ||
import "github.com/qor/oss/aliyun" | ||
|
||
func main() { | ||
storage := s3.New(s3.Config{ | ||
AccessID: "access_id", | ||
AccessKey: "access_key", | ||
Region: "region", | ||
Bucket: "bucket", | ||
Endpoint: "cdn.getqor.com", | ||
ACL: awss3.BucketCannedACLPublicRead, | ||
}) | ||
|
||
// Save a reader interface into storage | ||
storage.Put("/sample.txt", reader) | ||
|
||
// Get file with path | ||
storage.Get("/sample.txt") | ||
|
||
// Get object as io.ReadCloser | ||
storage.GetStream("/sample.txt") | ||
|
||
// Delete file with path | ||
storage.Delete("/sample.txt") | ||
|
||
// List all objects under path | ||
storage.List("/") | ||
|
||
// Get Public Accessible URL (useful if current file saved privately) | ||
storage.GetURL("/sample.txt") | ||
} | ||
``` | ||
|
||
|
Oops, something went wrong.