fs

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package fs provides functions for filesystem operations.

Index

Constants

This section is empty.

Variables

View Source
var (
	// MarkdownOnly is a filter that only lets pass Markdown files.
	MarkdownOnly = func(file string) bool {
		return filepath.Ext(file) == ".md"
	}

	// NoUnderscores is a predefined filter that doesn't let pass
	// files starting with an underscore.
	NoUnderscores = func(file string) bool {
		filename := filepath.Base(file)
		return !strings.HasPrefix(filename, "_")
	}

	// ErrStreaming is returned from StreamFiles.
	ErrStreaming error = nil
)

Functions

func CopyFromOS added in v0.4.1

func CopyFromOS(targetFs afero.Fs, src, dest string, fileOnly bool) error

CopyFromOS copies a given directory from the OS filesystem into another filesystem instance to the desired destination.

If fileOnly is set to true, files will be copied directly into the destination directory without their directory structure inside src.

func IsSafeToRemove added in v0.4.4

func IsSafeToRemove(targetFs afero.Fs, path string, force bool) bool

IsSafeToRemove determines if a directory can be removed safely.

func Rmdir added in v0.1.5

func Rmdir(targetFs afero.Fs, path string) error

Rmdir removes an entire directory along with its contents. If the directory does not exist, nothing happens.

func StreamFiles

func StreamFiles(path string, files chan<- string, filters ...func(file string) bool) error

StreamFiles sends all relative file paths inside a given path that match the given filters through the files channel.

Types

This section is empty.

Jump to

Keyboard shortcuts

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