files

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadFromDisk

func LoadFromDisk(directory Directory, path string) (e error)

LoadFromDisk Loads the content of the paths into the directory recursively

func WalkFileTree

func WalkFileTree(directory Directory, consumer func(file File))

WalkFileTree iterates over each and every file instance found in the directory

Types

type Directory

type Directory interface {
	Name() (name paths.Path)
	AbsolutePath() (path paths.Path)

	Files() (files []File)
	File(path paths.Path) (file File)
	NewFile(path paths.Path) (newFile File)
	DeleteFile(path paths.Path)

	Directories() (directories []Directory)
	Directory(path paths.Path) (directory Directory)
	NewDirectory(path paths.Path) (newDirectory Directory)
	DeleteDirectory(path paths.Path)

	Parent() (parentDirectory Directory)
}

Directory represents a virtual directory containing files.

Name return the name of the directory excluding the paths it is in

Files returns the list of all files in the given directory

File returns the file for the given name or nil

NewFile creates a new File in the directory and returns the new instance

Delete deletes the file stored under the given name

Directories returns the directories stored under this directory

Directory returns the directory with the given name or nil

NewDirectory creates a new directory

DeleteDirectory deletes a directory

Parent returns the directory this directory is found in

func NewRootDirectory

func NewRootDirectory() Directory

NewRootDirectory returns a new root directory

type File

type File interface {
	Name() (name paths.Path)
	AbsolutePath() (path paths.Path)

	CopyContent(writer io.Writer) (e error)
	Write(reader io.Reader) (e error)
	WriteFlagged(reader io.Reader, append bool) (e error)
	Delete()

	Parent() (parentDirectory Directory)
}

File represents a digital file object

Name returns the name of the file, excluding the paths it is stored in

CopyContent stores the files binary content in the writer

Write writes content to the file. The default will not append to the file

Delete deletes the file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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