os

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2022 License: Apache-2.0 Imports: 10 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS struct {
	// contains filtered or unexported fields
}

FS wraps the 'os' package as an FS implementation.

func NewFS

func NewFS() *FS

NewFS returns a new FS. All file paths are relative to the root path. Root is '/' on Unix and 'C:\' on Windows. Use fs.Sub() to select a different root path. SubVolume on Windows can set the volume name.

func (*FS) Chmod

func (fs *FS) Chmod(name string, mode hackpadfs.FileMode) error

Chmod implements hackpadfs.ChmodFS

func (*FS) Chown

func (fs *FS) Chown(name string, uid, gid int) error

Chown implements hackpadfs.ChownFS

func (*FS) Chtimes

func (fs *FS) Chtimes(name string, atime time.Time, mtime time.Time) error

Chtimes implements hackpadfs.ChtimesFS

func (*FS) Create

func (fs *FS) Create(name string) (hackpadfs.File, error)

Create implements hackpadfs.CreateFS

func (*FS) FromOSPath added in v0.1.5

func (fs *FS) FromOSPath(osPath string) (string, error)

FromOSPath converts an absolute 'os' package path to the valid equivalent 'io/fs' package path for this FS.

Returns an error for any of the following conditions:

  • The path is not absolute.
  • The path does not match fs's volume name set by SubVolume().
  • The path does not share fs's root path set by Sub().

func (*FS) Lstat

func (fs *FS) Lstat(name string) (hackpadfs.FileInfo, error)

Lstat implements hackpadfs.LstatFS

func (*FS) Mkdir

func (fs *FS) Mkdir(name string, perm hackpadfs.FileMode) error

Mkdir implements hackpadfs.MkdirFS

func (*FS) MkdirAll

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

MkdirAll implements hackpadfs.MkdirAllFS

func (*FS) Open

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

Open implements hackpadfs.FS

func (*FS) OpenFile

func (fs *FS) OpenFile(name string, flag int, perm hackpadfs.FileMode) (hackpadfs.File, error)

OpenFile implements hackpadfs.OpenFileFS

func (*FS) ReadDir

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

ReadDir implements hackpadfs.ReadDirFS

func (*FS) ReadFile

func (fs *FS) ReadFile(name string) ([]byte, error)

ReadFile implements hackpadfs.ReadFile

func (*FS) Remove

func (fs *FS) Remove(name string) error

Remove implements hackpadfs.RemoveFS

func (*FS) RemoveAll

func (fs *FS) RemoveAll(name string) error

RemoveAll implements hackpadfs.RemoveAllFS

func (*FS) Rename

func (fs *FS) Rename(oldname, newname string) error

Rename implements hackpadfs.RenameFS

func (*FS) Stat

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

Stat implements hackpadfs.StatFS

func (*FS) Sub

func (fs *FS) Sub(dir string) (hackpadfs.FS, error)

Sub implements hackpadfs.SubFS

func (*FS) SubVolume added in v0.1.3

func (fs *FS) SubVolume(volumeName string) (hackpadfs.FS, error)

SubVolume is like Sub, but only sets the volume name (i.e. for Windows). Calling SubVolume again on the returned FS results in an error.

func (fs *FS) Symlink(oldname, newname string) error

Symlink implements hackpadfs.SymlinkFS

func (*FS) ToOSPath added in v0.1.5

func (fs *FS) ToOSPath(fsPath string) (string, error)

ToOSPath converts a valid 'io/fs' package path to the equivalent 'os' package path for this FS

Jump to

Keyboard shortcuts

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