Skip to content

Latest commit

 

History

History
47 lines (36 loc) · 825 Bytes

readme.md

File metadata and controls

47 lines (36 loc) · 825 Bytes

Simple Google Cloud Storage - Golang

Simple package to manage your file in Google Cloud Storage

Development by:

  • Findryankp

Import

go get github.com/Findryankp/goGcs

Example

package main

import (
	"fmt"

	"github.com/Findryankp/goGcs"
)

func main() {
	//set max file size
	goGcs.MaxFileLimit = 10000000

	//path your credential
	goGcs.GscCredentialFilename = "filecred.json"

	bucketName := "bucket_images"
	filePathName := "testImage.png"
	fileNameInGCS := "testImageBucket.png"

	//upload file
	if err := goGcs.UploadImage(bucketName, filePathName, fileNameInGCS); err != nil {
		fmt.Println(err.Error())
	}

	//delete file
	if err := goGcs.DeleteImage(bucketName, filePathName); err != nil {
		fmt.Println(err.Error())
	}
}

Tutorial

  1. Create Your Bucket First
  2. Generate Key