bfsgs

package
v0.2.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package bfsgs abstracts Google Cloud Storage bucket.

When imported, it registers a global `gs://` scheme resolver and can be used like:

import (
  "github.com/bsm/bfs"

  _ "github.com/bsm/bfs/bfsgs"
)

func main() {
  ctx := context.Background()

  u, _ := url.Parse("gs://bucket?prefix=custom%2Fprefix")
  bucket, _ := bfs.Resolve(ctx, u)

  f, _ := bucket.Open(ctx, "file/within/prefix.txt")
  ...
}

bfs.Resolve supports the following query parameters:

prefix      - path prefix/namespace within the bucket
scopes      - custom scopes
credentials - path to custom credentials file

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, bucket string, cfg *Config) (bfs.Bucket, error)

New initiates an bfs.Bucket backed by Google Cloud Storage.

Types

type Config

type Config struct {
	Options       []option.ClientOption // options for Google API client
	Prefix        string                // an optional path prefix
	PredefinedACL string                // an optional predefined ACL string, e.g. "publicRead"
}

Config is passed to New to configure the Google Cloud Storage connection.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL