Documentation
¶
Overview ¶
Package fsx provides a clean, simple filesystem abstraction allowing you to use a consistent API regardless of the underlying implementation whether it's the real OS filesystem or a memory backed test filesystem.
Index ¶
Constants ¶
View Source
const ( // DefaultDirPermissions are the default UNIX permission bits for a new directory, they // are the equivalent permissions to the result of running mkdir. DefaultDirPermissions = 0o755 // DefaultFilePermissions are the default UNIX permission bits for a new file, they // are the equivalent permissions to the result of running touch. DefaultFilePermissions = 0o666 // Separator is the OS-specific filepath separator. Separator = string(filepath.Separator) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File interface {
// Name returns the name of the file as presented to Open.
//
// It is safe to call Name after Close.
Name() string
// Exists reports whether the file exists in the filesystem.
Exists() bool
// Truncate truncates the file to a specific size.
Truncate(size int64) error
}
File represents a single named file in the filesystem.
type FileSystem ¶
type FileSystem interface {
// Create creates a new named file (truncating it if it already exists).
Create(name string) (File, error)
}
FileSystem represents an abstract filesystem in a storage-agnostic interface.
Directories
¶
| Path | Synopsis |
|---|---|
|
internal
|
|
|
flag
Package flag provides constants for OS file/dir flags.
|
Package flag provides constants for OS file/dir flags. |
|
Package memory provides a FileSystem implementation backed by a in-memory storage mechanism that does not require any access to the underlying OS.
|
Package memory provides a FileSystem implementation backed by a in-memory storage mechanism that does not require any access to the underlying OS. |
|
Package real provides a FileSystem implementation backed by the OS for interacting with the real, physical file system in an OS agnostic way.
|
Package real provides a FileSystem implementation backed by the OS for interacting with the real, physical file system in an OS agnostic way. |
Click to show internal directories.
Click to hide internal directories.
