file

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: MIT Imports: 7 Imported by: 3

README

Утилиты работы с файлами

Version: 1.0.0 (13/10/2021)

Константы ошибок

  • ErrFileError
  • ErrFileNotFound
  • ErrFileReadError
  • ErrJSONParseError
  • ErrPathCreateError
  • ErrFileWriteError
  • ErrJSONMarshallError
  • ErrFileDeleteError

Функции

GetCWD()
func GetCWS() string {}
GetBinName()
func GetBinName() string {}
GetBinDir()
func GetBinDir() string {}
GetHome()
func GetHome() string {}
RealPath()
func RealPath(string) string {}

Функция производит замены первых символов:

  • "." GetBinDir()
  • "~" GetHome()
  • "/" - строка возвращается без изменений
  • остальные строки предваряются GetCWD()
Ext()
func Ext(string) string {}
Exists()
func Exists(string) bool {}
Load()
func Load(string) ([]byte, *errs.Err) {}
LoadJSON()
func LoadJSON(string) (interface{}, *errs.Err) {}
Save()
func Save(string, []byte) *errs.Err {}
SaveJSON()
func SaveJSON(string, interface{}) *errs.Err {}
Remove()
func Remove(string) *errs.Err{}

Documentation

Index

Constants

View Source
const (
	ErrFileError         errs.ErrCode = "ErrFileError"
	ErrFileNotFound      errs.ErrCode = "ErrFileNotFound"
	ErrFileReadError     errs.ErrCode = "ErrFileReadError"
	ErrJSONParseError    errs.ErrCode = "ErrJSONParseError"
	ErrPathCreateError   errs.ErrCode = "ErrPathCreateError"
	ErrFileWriteError    errs.ErrCode = "ErrFileWriteError"
	ErrJSONMarshallError errs.ErrCode = "ErrJSONMarshallError"
	ErrFileDeleteError   errs.ErrCode = "ErrFileDeleteError"
)

Variables

This section is empty.

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, *errs.Err)

func LoadJSON

func LoadJSON(file string) (data interface{}, err *errs.Err)

func RealPath

func RealPath(path string) string

func Remove

func Remove(file string) *errs.Err

func Save

func Save(file string, data []byte) *errs.Err

func SaveJSON

func SaveJSON(file string, data interface{}) *errs.Err

Types

This section is empty.

Jump to

Keyboard shortcuts

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