Skip to content
This repository has been archived by the owner on Oct 19, 2021. It is now read-only.

beyondstorage/go-service-gcs

Repository files navigation

go-services-gcs

Google Cloud Storage service support for go-storage.

Notes

This package has been moved to go-storage.

go get go.beyondstorage.io/services/gcs/v3

Install

go get github.com/beyondstorage/go-service-gcs/v2

Usage

import (
	"log"

	_ "github.com/beyondstorage/go-service-gcs/v2"
	"github.com/beyondstorage/go-storage/v4/services"
)

func main() {
	store, err := services.NewStoragerFromString("gcs://bucket_name/path/to/workdir?credential=file:<absolute_path_to_token_file>&project_id=<google_cloud_project_id>")
	if err != nil {
		log.Fatal(err)
	}
	
	// Write data from io.Reader into hello.txt
	n, err := store.Write("hello.txt", r, length)
}