Replace httpx with Go's standard HTTP client
Remove paralleltest linter
Run more tests in parallel
Package bunnystorage
is a simple and easy-to-use package for
interacting with the Bunny.net Edge Storage
API. It provides a
convenient way to manage files in your storage zones.
To install bunnystorage
, run:
go get git.sr.ht/~jamesponddotco/bunnystorage-go
package main
import (
"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.
Anyone can help make bunnystorage
better. Check out the contribution
guidelines
for more information.
The following resources are available:
Released under the MIT License.