Skip to content

a rainbow bridge for shipping files to any cloud storage service

License

Notifications You must be signed in to change notification settings

opensauceryafrica/bifrost

Repository files navigation

Bifrost

Rainbow bridge for shipping your files to any cloud storage service with the same function calls.

Table of contents

Problem Statement

Many projects need to store files in the cloud and different projects might use different cloud storage providers or, sometimes, multiple cloud providers all at once. Using different SDKs with different implementations for each provider can be tedious and time-consuming. Bifrost aims to simplify the process of working with multiple cloud storage providers by providing a consistent API for all of them.

Installation

To install the Bifrost package, run the following command in your terminal:

go get github.com/opensaucerer/bifrost

Usage

package main

import (
	"fmt"
	"os"
	"github.com/opensaucerer/bifrost"
)

// mount a bridge to gcs
bridge, _ := bifrost.NewRainbowBridge(&bifrost.BridgeConfig{
	DefaultBucket:   "bifrost",
	DefaultTimeout:  10,
	Provider:        bifrost.GoogleCloudStorage,
	CredentialsFile: "/path/to/service/account/json", // this is not required if you are using google's default credentials
	EnableDebug:     true,
	PublicRead:      true,
})
defer bridge.Disconnect()
fmt.Printf("Connected to %s\n", bridge.Config().Provider)

// upload a file to gcs using the bridge
guf, _ := bridge.UploadFile(bifrost.File{
	Path:     "../shared/image/aand.png",
	Filename: "a_and_ampersand.png",
	Options: map[string]interface{}{
		bifrost.OptMetadata: map[string]string{
			"originalname": "aand.png",
		},
	},
})
fmt.Printf("Uploaded file %s to GCS at: %s\n", guf.Name, guf.Preview)

The above example clearly demonstrates the speed, simplicity, and ease of use that Bifrost offers. Now you know what it feels like to ride with Thor!

If you want to learn more about how Bifrost is creating different methods to make it easier to use different cloud providers, you can follow these links:

Variants

Bifrost also exists in other forms and languages and you are free to start a new variant of bifrost in any other form or language of your choice. For now, below are the know variants of bifrost.

Contributing

Bifrost is an open source project and we welcome contributions of all kinds. Please read our contributing guide to learn about our development process, how to propose bug fixes and improvements, and how to build and test your changes to Bifrost.

License

Bifrost is MIT licensed.

Changelog

See changelog for more details.

Contributors

Made with contrib.rocks.

About

a rainbow bridge for shipping files to any cloud storage service

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 7