https://github.com/jamesponddotco/bunnystorage-go
[READ-ONLY] Unofficial Go client for Bunny.net's edge storage API.
https://github.com/jamesponddotco/bunnystorage-go
api-client api-client-go bunny bunnycdn bunnynet bunnystorage go
Last synced: 5 months ago
JSON representation
[READ-ONLY] Unofficial Go client for Bunny.net's edge storage API.
- Host: GitHub
- URL: https://github.com/jamesponddotco/bunnystorage-go
- Owner: jamesponddotco
- License: mit
- Created: 2023-04-21T16:40:02.000Z (about 2 years ago)
- Default Branch: trunk
- Last Pushed: 2024-01-25T00:27:13.000Z (about 1 year ago)
- Last Synced: 2024-08-01T10:20:51.566Z (9 months ago)
- Topics: api-client, api-client-go, bunny, bunnycdn, bunnynet, bunnystorage, go
- Language: Go
- Homepage: https://sr.ht/~jamesponddotco/bunnystorage-go/
- Size: 260 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# bunnystorage-go
[](https://godocs.io/git.sr.ht/~jamesponddotco/bunnystorage-go)
[](https://goreportcard.com/report/git.sr.ht/~jamesponddotco/bunnystorage-go)
[](https://builds.sr.ht/~jamesponddotco/bunnystorage-go?)Package `bunnystorage` is a simple and easy-to-use package for
interacting with the [Bunny.net Edge Storage
API](https://docs.bunny.net/reference/storage-api). It provides a
convenient way to manage files in your storage zones.## Installation
To install `bunnystorage`, run:
```console
go get git.sr.ht/~jamesponddotco/bunnystorage-go
```## Usage
```go
package mainimport (
"context"
"log"
"os""git.sr.ht/~jamesponddotco/bunnystorage-go"
)func main() {
readOnlyKey, ok := os.LookupEnv("BUNNYNET_READ_API_KEY")
if !ok {
log.Fatal("missing env var: BUNNYNET_READ_API_KEY")
}readWriteKey, ok := os.LookupEnv("BUNNYNET_WRITE_API_KEY")
if !ok {
log.Fatal("missing env var: BUNNYNET_WRITE_API_KEY")
}// Create new Config to be initialize a Client.
cfg := &bunnystorage.Config{
StorageZone: "my-storage-zone",
Key: readWriteKey,
ReadOnlyKey: readOnlyKey,
Endpoint: bunnystorage.EndpointFalkenstein,
}// Create a new Client instance with the given Config.
client, err := bunnystorage.NewClient(cfg)
if err != nil {
log.Fatal(err)
}// List files in the storage zone.
files, _, err := client.List(context.Background(), "/")
if err != nil {
log.Fatal(err)
}for _, file := range files {
log.Printf("File: %s, Size: %d\n", file.ObjectName, file.Length)
}
}
```For more examples and usage details, please [check the Go reference
documentation](https://godocs.io/git.sr.ht/~jamesponddotco/bunnystorage-go).## Contributing
Anyone can help make `bunnystorage` better. Check out [the contribution
guidelines](https://git.sr.ht/~jamesponddotco/bunnystorage-go/tree/trunk/item/CONTRIBUTING.md)
for more information.## Resources
The following resources are available:
- [Package documentation](https://godocs.io/git.sr.ht/~jamesponddotco/bunnystorage-go).
- [Support and general discussions](https://lists.sr.ht/~jamesponddotco/bunnystorage-discuss).
- [Patches and development related questions](https://lists.sr.ht/~jamesponddotco/bunnystorage-devel).
- [Instructions on how to prepare patches](https://git-send-email.io/).
- [Feature requests and bug reports](https://todo.sr.ht/~jamesponddotco/bunnystorage).---
Released under the [MIT License](LICENSE.md).