filesys

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package filesys provides an abstraction for working with file systems, mainly to facilitate testing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File interface {
	io.Reader
	io.Seeker
	io.Closer
}

File provides the interface implemented by values returned from a file system's Open method.

type FileSystem

type FileSystem interface {
	Open(path string) (File, error)
	Lstat(path string) (os.FileInfo, error)
	Readlink(path string) (string, error)
	Readdirnames(path string) ([]string, error)
}

FileSystem provides the interface for operations over a file system.

func Map

func Map(m map[string][]byte, links []string) FileSystem

Map returns a FileSystem for m, wherein keys are file paths and values are file contents. File paths should not contain a leading slash. If links is not nil, it will be used to simulate symbolic links: for each key in m that is also in links, its value in m is treated as the link target.

func OS

func OS() FileSystem

OS returns a FileSystem for working with os files.

Jump to

Keyboard shortcuts

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