files

package
v0.21.12 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: GPL-3.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	FileModeOnlyRead  os.FileMode = 0444
	FileModeReadWrite os.FileMode = 0666
)

FileMode

View Source
const (
	ReadBufferLength = 1024
)

ReadBufferLength default reader buffer length

Variables

View Source
var (
	ErrFileIsAlreadyOpen = errors.New("file is already open")
	ErrFailedReadFile    = errors.New("failed read file")

	ErrReadBufferLengthBelowZero = errors.New("read buffer must above zero")
)

errors

Functions

This section is empty.

Types

type FileRepo

type FileRepo interface {
	// judge if file is opening
	FileOpened(string) bool
	// read file
	Read(string) (b []byte, n int, err error)
	// rewrite file with context
	Write(name, context string) (int, error)
	WriteBytes(name string, b []byte) (int, error)
	// append context to the file
	WriteAppend(name, context string) (int, error)
	WriteAppendBytes(name string, b []byte) (int, error)
	// rename file
	Rename(oldpath, newpath string) error
	// set length of buffer to read file, default: 1024
	SetReadBufLength(int) error
	// get information with file name
	FileInfo(name string) (os.FileInfo, error)
}

FileRepo execute file functions

func New

func New() FileRepo

New return filerepo with default executor

type FileStatus

type FileStatus int

FileStatus defile file status

const (
	// nothing
	FileStatusClosed FileStatus = iota
	// file is opened
	FileStatusOpening
	// file is moving or rename
	FileStatusMoving
)

file status

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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