Skip to content

Latest commit

 

History

80 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bunnystorage-go

Go Documentation Go Report Card builds.sr.ht status

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.

Installation

To install bunnystorage, run:

go get git.sr.ht/~jamesponddotco/bunnystorage-go

Usage

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.

Contributing

Anyone can help make bunnystorage better. Check out the contribution guidelines for more information.

Resources

The following resources are available:


Released under the MIT License.

About

[READ-ONLY] Unofficial Go client for Bunny.net's edge storage API.

Topics

Resources

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages