fs

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: MIT Imports: 9 Imported by: 13

README

fs

file system relevant utils.

Build Status Coverage Status Go Report Card Documentation

Install

$ go get github.com/lovego/fs

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Append

func Append(p string, b []byte) error

func Copy

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

func CopyWithMode

func CopyWithMode(src, dst string, mode os.FileMode) (err error)

func DetectDir

func DetectDir(dir string, features ...string) string

func Exist

func Exist(p string) bool

func GoModPath

func GoModPath() string

func GoPath

func GoPath() string

func GoSrcPath

func GoSrcPath() string

func IsDir

func IsDir(p string) bool

func IsEmptyDir

func IsEmptyDir(p string) (bool, error)

func IsFile

func IsFile(p string) bool

func NotExist

func NotExist(p string) bool

func OpenAppend

func OpenAppend(p string) (*os.File, error)

func SourceDir

func SourceDir() string
Example
p := SourceDir()
fmt.Println(strings.HasSuffix(filepath.ToSlash(p), `/fs`))
Output:

true

func SourceFile

func SourceFile() string
Example
p := SourceFile()
fmt.Println(strings.HasSuffix(filepath.ToSlash(p), `/fs/path_test.go`))
Output:

true

Types

type LogFile

type LogFile struct {
	sync.RWMutex
	*os.File
	// contains filtered or unexported fields
}

func NewLogFile

func NewLogFile(path string) (*LogFile, error)
Example
f, err := NewLogFile("./a.txt")
fmt.Println(f.path, f.File != nil, err)
Output:

./a.txt true <nil>

func (*LogFile) Write

func (l *LogFile) 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