fs

package
v0.0.0-...-b1582e7 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// FilesBucket is the name of the bucket containing file information
	FilesBucket = []byte("files")
)

Functions

This section is empty.

Types

type DBFile

type DBFile struct {
	// Name is the filename
	Name string
	// Size is the file size in bytes
	Size int64
	// ModTime is the file time of last modification
	ModTime time.Time

	// email is the email of the person who uploaded the file
	Email string
	// Token is used to verify user uploads
	Token string
	// Authorized is set to true after the user verified the upload
	Authorized bool
}

A DBFile is the structure used to serialize file information to boltdb

func FromFileInfo

func FromFileInfo(fi os.FileInfo) DBFile

FromFileInfo returns an instance of DBFile constructed from a os.FileInfo Email, Token and Authorized are left at their default value

type Dir

type Dir string

A Dir implements FileSystem using the native file system restricted to a specific directory tree.

While the OpenFile method takes '/'-separated paths, a Dir's string value is a filename on the native file system, not a URL, so it is separated by filepath.Separator, which isn't necessarily '/'.

An empty Dir is treated as ".".

func (Dir) Create

func (d Dir) Create(name string) (*os.File, error)

Create creates a file truncating it if it already exists

func (Dir) Open

func (d Dir) Open(name string) (*os.File, error)

Open opens a file in read-only mode

func (Dir) Stat

func (d Dir) Stat(name string) (os.FileInfo, error)

Stat returns a FileInfo describing the named file.

Jump to

Keyboard shortcuts

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