fs

package
v0.0.0-...-974551f Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2019 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFile

func AppendFile(file string, data []byte) error

func CheckDir

func CheckDir(dir string) (err error)

Check if the Directory exist

func CheckFile

func CheckFile(filepath string) (err error)

Check if the file exist

func Chmod

func Chmod(filepath string, mode os.FileMode) error

change the file permission

func Copy

func Copy(src string, target string) (err error)

Copy a File or Directory

func LStat

func LStat(path string) (info os.FileInfo, err error)

File Statistic (Stat)

func Lchown

func Lchown(path string, uid int, gid int) error

func Mkdir

func Mkdir(dir string) (err error)

Create a Directory

func Move

func Move(src string, target string) (err error)

Move File/Directory(Folder)

func OuputFile

func OuputFile(filepath string, data []byte) error

Almost the same as writeFile (i.e. it overwrites), except that if the parent directory does not exist, it's created.

func PathExists

func PathExists(path string) (isExist bool)

Check if path is exist

func ReadDir

func ReadDir(dir string) (files []string, err error)

Read Directory and get file list

func ReadFile

func ReadFile(filepath string) ([]byte, error)

Read a file

func ReadStream

func ReadStream(filepath string) (stream io.Reader, err error)

Create a read stream

func Remove

func Remove(path string) error

Remove File/Directory

func Rename

func Rename(oldPath string, newPath string) error

Rename File/Directory

func Stat

func Stat(path string) (info os.FileInfo, err error)

File Statistic (Stat)

func TempDir

func TempDir(dir string, prefix string) (string, error)

Create random temporary Directory

func Truncate

func Truncate(filepath string, len int64) error

func WriteFile

func WriteFile(filepath string, data []byte) error

Write a file

func WriteStream

func WriteStream(filepath string) (stream io.Writer, err error)

Create a read stream

Types

type FileSystem

type FileSystem struct {
	Base string
}

FileSystem file system storage

func New

func New(base string) *FileSystem

New initialize FileSystem storage

func (FileSystem) Delete

func (fileSystem FileSystem) Delete(path string) error

Delete delete file

func (FileSystem) Get

func (fileSystem FileSystem) Get(path string) (*os.File, error)

Get receive file with given path

func (FileSystem) GetFullPath

func (fileSystem FileSystem) GetFullPath(path string) string

GetFullPath get full path from absolute/relative path

func (FileSystem) GetStream

func (fileSystem FileSystem) GetStream(path string)

GetStream get file as stream

func (FileSystem) List

func (fileSystem FileSystem) List(path string) ([]*ofs.Object, error)

List of all objects under current path

func (FileSystem) Put

func (fileSystem FileSystem) Put(path string, reader io.Reader) (*ofs.Object, error)

Put store a reader into given path

Jump to

Keyboard shortcuts

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