abio

package module
v0.0.0-...-5130f3d Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: Apache-2.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

abio

auto backup (file)io

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosed = errors.New("文件已被关闭")
)

Functions

func AbsPathOfFile

func AbsPathOfFile(name string) string

获取文件绝对路径

func CopyFileTo

func CopyFileTo(dstName string, f *os.File) (err error)

func FileExists

func FileExists(name string) bool

FileExists reports whether the named file or directory exists.

func FileSize

func FileSize(f *os.File) int64

func SelfDir

func SelfDir() string

func TouchFile

func TouchFile(fileName string) error

TouchFile If the file does not exist, it is created automatically. Do not do anything if the file already exists.

Types

type AbFile

type AbFile struct {
	// contains filtered or unexported fields
}

AbFile 可以实现自动备份的文件对象

func NewAbFile

func NewAbFile(name string, op *Options) (abFile *AbFile)

NewAbFile 构造函数

func (*AbFile) Close

func (ab *AbFile) Close() error

func (*AbFile) File

func (ab *AbFile) File() *os.File

func (*AbFile) Read

func (ab *AbFile) Read(p []byte) (n int, err error)

func (*AbFile) Write

func (ab *AbFile) Write(p []byte) (n int, err error)

type Options

type Options struct {
	MaxSize  int64 //文件的最大值,当达到MaxSize时,自动备份文件
	SaveDays int   //文件保存天数
}

Options io 对象的选项

Jump to

Keyboard shortcuts

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