file

package
v0.0.0-...-26f7dc4 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2015 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package file provides a client for Google Cloud Storage.

NOTE: The Files API was deprecated on June 11, 2013 (v1.8.1) and will be shut down soon, at which point these functions will no longer work. Use Google Cloud Storage instead (https://cloud.google.com/storage/).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(c appengine.Context, filename string, opts *CreateOptions) (wc io.WriteCloser, absFilename string, err error)

Create creates a new file, opened for append.

The file must be closed when done writing.

The provided filename may be absolute ("/gs/bucketname/objectname") or may be just the filename, in which case the bucket is determined from opts. The absolute filename is returned.

func DefaultBucketName

func DefaultBucketName(c appengine.Context) (string, error)

DefaultBucketName returns the name of this application's default Google Cloud Storage bucket.

func Delete

func Delete(c appengine.Context, filename string) error

Delete deletes a file.

func Stat

func Stat(c appengine.Context, filename string) (os.FileInfo, error)

Stat stats a file.

Types

type BlobReader

type BlobReader interface {
	io.Reader
	io.ReaderAt
	io.Seeker
}

BlobReader is the interface available when reading blobs.

func OpenBlob

func OpenBlob(c appengine.Context, blobKey appengine.BlobKey) BlobReader

OpenBlob returns a reader for a blob. It always succeeds; if the blob does not exist then an error will be reported upon first read.

type CreateOptions

type CreateOptions struct {
	// MIMEType is the MIME type to use.
	// The empty string means to use "application/octet-stream".
	MIMEType string

	// The Google Cloud Storage bucket name to use.
	// The empty string means to use the default bucket.
	BucketName string
}

CreateOptions are the file creation options. A nil *CreateOptions means the same as using all the default values.

type FileReader

type FileReader interface {
	io.Closer
	io.Reader
	io.ReaderAt
	io.Seeker
}

FileReader is the interface available when reading files.

func Open

func Open(c appengine.Context, filename string) (FileReader, error)

Open opens a file for reading.

Jump to

Keyboard shortcuts

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