file

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 8 Imported by: 3

README

file

Представление файла и утилиты работы с файловой системой

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFileNotFound    error = errors.New("file not found")
	ErrFileReadError   error = errors.New("file read error")
	ErrFileWriteError  error = errors.New("file write error")
	ErrFileDeleteError error = errors.New("file delete error")
	ErrPathCreateError error = errors.New("path create error")
	ErrPathDeleteError error = errors.New("path delete error")
)

Functions

func Exists

func Exists(file string) bool

func Ext

func Ext(file string) string

func GetBinDir

func GetBinDir() string

func GetBinName

func GetBinName() string

func GetCWD

func GetCWD() string

func GetHome

func GetHome() string

func Load

func Load(file string) ([]byte, error)

func LoadJSON

func LoadJSON(file string) (data interface{}, e error)

func RealPath

func RealPath(path string) string

func Remove

func Remove(file string) error

func Save

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

func SaveJSON

func SaveJSON(file string, data interface{}) error

Types

type File added in v1.2.0

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

func NewFile added in v1.2.0

func NewFile(name string) (f *File, e error)

func (*File) Append added in v1.2.0

func (f *File) Append(data []byte) error

func (*File) ReadAll added in v1.2.0

func (f *File) ReadAll() ([]byte, error)

func (*File) ReadJSON added in v1.2.0

func (f *File) ReadJSON() (data interface{}, err error)

func (*File) ReadString added in v1.2.0

func (f *File) ReadString() (string, error)

func (*File) Write added in v1.2.0

func (f *File) Write(data []byte) error

func (*File) WriteJSON added in v1.2.0

func (f *File) WriteJSON(data interface{}) error

Jump to

Keyboard shortcuts

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