localfs

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diskfree

func Diskfree(drive string, freeBytesAvailable *uint64) error

func LocalMountPoint

func LocalMountPoint(loc path.Local) (string, error)

func OnUnix

func OnUnix() bool

func OnWindows

func OnWindows() bool

Types

type FS

type FS struct {
	*wrapfs.FS
}

func New

func New(dir path.Local) (ofs *FS, err error)

func WD

func WD() (*FS, error)

a filesystem based on the working directory

func (*FS) Delete

func (d *FS) Delete(p path.Relative, recursive bool) (err error)

func (*FS) Drive

func (d *FS) Drive(p path.Relative) (path.Local, error)

func (*FS) FreeSpace

func (d *FS) FreeSpace(p path.Relative) int64

func (*FS) Move

func (d *FS) Move(src path.Relative, trgDir path.Relative) error

Move should return an error, if - the src does not exist - src is a directory and moving of directories is not supported by the fs - the resulting path trgDir.Join(path.Name(src)) does already exist - src and trgdir have different mountpoints

func (*FS) Rename

func (d *FS) Rename(old path.Relative, newName string) error

Rename renames a file RenameFile renames a file. It is not allowed for directories and will also not move files, if the target is a directory. Renaming will fail, if there exists already a file under this name. Renaming will also fail, if the new file path is in a different directory should fail when the new name is not a name but a path

func (*FS) SetMode

func (d *FS) SetMode(name path.Relative, m fs.FileMode) error

func (*FS) Write

func (d *FS) Write(name path.Relative, data io.ReadCloser, recursive bool) error

func (*FS) WriteWithMode

func (d *FS) WriteWithMode(p path.Relative, rd io.ReadCloser, perm fs.FileMode, recursive bool) (err error)

WriteWithMode reads from the given reader and writes all the content to the file of the given path. If the file already exists, if will be overwritten. Otherwise the file is newly created If name is a directory, data is ignored and the directory is created. If the directory is already there, nothing happens

Jump to

Keyboard shortcuts

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