osfs

package
v5.0.0-preview6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 3 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS struct{}

FS implementation of `fsutil.FS` for the local OS file system.

func (FS) FileExists

func (fs FS) FileExists(file string) bool

FileExists returns true if the file at the given path exists and is readable. Returns false if the given file is a directory.

func (FS) Getwd

func (FS) Getwd() (string, error)

Getwd returns a rooted path name corresponding to the current directory. If the current directory can be reached via multiple paths (due to symbolic links), Getwd may return any one of them.

func (FS) IsDirectory

func (fs FS) IsDirectory(path string) bool

IsDirectory returns true if the file at the given path exists, is a directory and is readable.

func (FS) Mkdir

func (FS) Mkdir(path string, perm fs.FileMode) error

Mkdir creates a new directory with the specified name and permission bits (before umask). If there is an error, it will be of type `*PathError`.

func (FS) MkdirAll

func (FS) MkdirAll(path string, perm fs.FileMode) error

MkdirAll creates a directory named path, along with any necessary parents, and returns `nil`, or else returns an error. The permission bits perm (before umask) are used for all directories that `MkdirAll` creates. If path is already a directory, `MkdirAll` does nothing and returns `nil`.

func (FS) Open

func (FS) Open(name string) (fs.File, error)

Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode `O_RDONLY`. If there is an error, it will be of type `*PathError“.

func (FS) OpenFile

func (FS) OpenFile(path string, flag int, perm fs.FileMode) (io.ReadWriteCloser, error)

OpenFile is the generalized open call. It opens the named file with specified flag (`O_RDONLY` etc.). If the file does not exist, and the `O_CREATE` flag is passed, it is created with mode perm (before umask). If successful, methods on the returned file can be used for I/O. If there is an error, it will be of type `*PathError`.

func (FS) ReadDir

func (FS) ReadDir(name string) ([]fs.DirEntry, error)

ReadDir reads the named directory, returning all its directory entries sorted by filename. If an error occurs reading the directory, ReadDir returns the entries it was able to read before the error, along with the error.

func (FS) Remove

func (FS) Remove(path string) error

Remove removes the named file or (empty) directory. If there is an error, it will be of type `*PathError`.

func (FS) RemoveAll

func (FS) RemoveAll(path string) error

RemoveAll removes path and any children it contains. It removes everything it can but returns the first error it encounters. If the path does not exist, `RemoveAll` returns `nil` (no error). If there is an error, it will be of type `*PathError`.

func (FS) Stat

func (FS) Stat(name string) (fs.FileInfo, error)

Stat returns a FileInfo describing the named file. If there is an error, it will be of type `*PathError`.

Jump to

Keyboard shortcuts

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