localfs

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Overview

Package localfs implements virtual filesystem abstraction for a local filesystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy added in v0.4.0

func Copy(ctx context.Context, targetPath string, e fs.Entry, opt CopyOptions) error

Copy copies e into targetPath in the local file system. If e is an fs.Directory, then the contents are recursively copied. The targetPath must not exist, except when the target path is the root directory. In that case, e must be a fs.Directory and its contents are copied to the root directory. Copy does not overwrite files or directories and returns an error in that case. It also returns an error when the the contents cannot be restored, for example due to an I/O error.

func Directory

func Directory(path string) (fs.Directory, error)

Directory returns fs.Directory for the specified path.

func NewEntry

func NewEntry(path string) (fs.Entry, error)

NewEntry returns fs.Entry for the specified path, the result will be one of supported entry types: fs.File, fs.Directory, fs.Symlink.

Types

type CopyOptions added in v0.4.0

type CopyOptions struct {
	// If a directory already exists, overwrite the directory.
	OverwriteDirectories bool
	// Indicate whether or not to overwrite existing files. When set to false,
	// the copier does not modify already existing files and returns an error
	// instead.
	OverwriteFiles bool
}

CopyOptions contains the options for copying a file system tree

Jump to

Keyboard shortcuts

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