os

package
v0.0.0-...-33645b7 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package os provides an io.FS that is implemented using the os package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileMode

func FileMode(mode fs.FileMode) jsfs.OFOption

FileMode sets the fs.FileMode when opening a file with OpenFile().

Types

type FS

type FS struct{}

FS implemements fs.ReadDirFS/StatFS/ReadFileFS/GlobFS using functions defined in the "os" and "filepath" packages. In addition we support github.com/johnsiilver/fs/OpenFiler to allow for writing files.

func (*FS) Glob

func (f *FS) Glob(pattern string) (matches []string, err error)

Glob implements fs.GlobFS.Glob().

func (*FS) Open

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

Open implements fs.FS.Open().

func (*FS) OpenFile

func (f *FS) OpenFile(name string, flags int, options ...jsfs.OFOption) (fs.File, error)

OpenFile opens a file with the set flags and fs.FileMode. If you want to use the fs.File to write, you need to type assert if to *os.File. If Opening a file for

func (*FS) ReadDir

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

ReadDir implements fs.ReadDirFS.ReadDir().

func (*FS) ReadFile

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

ReadFile implements fs.ReadFileFS.ReadFile().

func (*FS) Stat

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

Stat implememnts fs.StatFS.Stat().

type File

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

File implememnts fs.File.

func (*File) Close

func (f *File) Close() error

func (*File) OSFile

func (f *File) OSFile() *os.File

OSFile returns the underlying *os.File.

func (*File) Read

func (f *File) Read(b []byte) (n int, err error)

func (*File) ReadDir

func (f *File) ReadDir(n int) ([]fs.DirEntry, error)

func (*File) Seek

func (f *File) Seek(offset int64, whence int) (ret int64, err error)

func (*File) Stat

func (f *File) Stat() (fs.FileInfo, error)

func (*File) Write

func (f *File) Write(b []byte) (n int, err error)

Jump to

Keyboard shortcuts

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