gocloud.devgocloud.dev/blob/fileblob Index | Files

package fileblob

import "gocloud.dev/blob/fileblob"

Package fileblob provides a blob implementation that uses the filesystem. Use OpenBucket to construct a blob.Bucket.

Blob keys are escaped before being used as filenames, and filenames are unescaped when they are passed back as blob keys during List. The escape algorithm is:

Filenames that can't be unescaped due to invalid escape sequences (e.g., "%%"), or whose unescaped key doesn't escape back to the filename (e.g., "~", which unescapes to "~", which escapes back to "%7E" != "~"), aren't visible using fileblob.

Open URLs

For blob.Open URLs, fileblob registers for the scheme "file"; URLs start with "file://".

The URL's Path is used as the root directory; the URL's Host is ignored. If os.PathSeparator != "/", any leading "/" from the Path is dropped. No query options are supported. Examples:

As

fileblob does not support any types for As.

Index

Functions

func OpenBucket

func OpenBucket(dir string, opts *Options) (*blob.Bucket, error)

OpenBucket creates a *blob.Bucket backed by the filesystem and rooted at dir, which must exist. See the package documentation for an example.

Types

type Options

type Options struct{}

Options sets options for constructing a *blob.Bucket backed by fileblob.

Source Files

attrs.go fileblob.go

Version
v0.8.0
Published
Dec 13, 2018
Platform
js/wasm
Imports
16 packages
Last checked
5 hours ago

Tools for package owners.