Documentation ¶
Index ¶
- Constants
- Variables
- func CheckPermission(src string) bool
- func CopyDir(src string, dst string) error
- func CopyFile(src, dst string) error
- func CreateDir(path string) error
- func CreateFile(path string) bool
- func DirExists(path string) bool
- func Exists(path string) bool
- func FileExists(path string) bool
- func FileMTime(file string) (int64, error)
- func FilePutContents(fileName, data string, flags ...interface{}) (int, error)
- func FileSize(file string) (int64, error)
- func GetDatasFromCSV(file *os.File) ([][]string, error)
- func GetDatasFromXlsx(file *os.File) ([][]string, error)
- func GetExePath() (exePath string, err error)
- func GetFileDir(filePath string) string
- func HumaneFileSize(s uint64) string
- func IsDir(fileName string) bool
- func IsFile(fp string) bool
- func IsLink(fileName string) bool
- func IsRegularFile(fileName string) bool
- func ReadJsonFileIntoVar(val interface{}, jFile string) error
- func ReadLine(r *bufio.Reader) ([]byte, error)
- func ToBytes(filePath string) ([]byte, error)
- func ToInt64(filePath string) (int64, error)
- func ToString(filePath string) (string, error)
- func ToTrimString(filePath string) (string, error)
- func ToUint64(filePath string) (uint64, error)
- func WriteBytes(filePath string, b []byte) (int, error)
- func WriteFileAtomic(filename string, data []byte, perm os.FileMode) error
- func WritePidFile(pidFile ...string)
- func WriteString(filePath string, s string) (int, error)
- func WriteValueToJsonFile(val interface{}, jFile string) error
- type SectionWriter
Constants ¶
View Source
const ( Byte = 1 KByte = Byte * 1024 MByte = KByte * 1024 GByte = MByte * 1024 TByte = GByte * 1024 PByte = TByte * 1024 EByte = PByte * 1024 )
Storage unit constants.
Variables ¶
View Source
var DEFAULT_PID_FILE = "log/PID"
DEFAULT_PID_FILE the default PID file name
View Source
var ErrExceedLimit = errors.New("write exceed limit")
View Source
var ErrOffset = errors.New("Seek: invalid offset")
View Source
var ErrWhence = errors.New("Seek: invalid whence")
Functions ¶
func CreateFile ¶ added in v0.0.6
func FileExists ¶ added in v0.0.4
func FilePutContents ¶ added in v0.0.4
FilePutContents write files with offset/limit fileName name of file to where put data flags[0] - flags how to put this data FileAppend | LockEx
func GetDatasFromCSV ¶ added in v0.0.9
GetDatasFromCSV 从csv文件获取数据
func GetDatasFromXlsx ¶ added in v0.0.9
GetDatasFromXlsx 从xlsx文件获取数据
func GetExePath ¶
func GetFileDir ¶
func HumaneFileSize ¶ added in v0.0.7
HumaneFileSize calculates the file size and generate user-friendly string.
func IsRegularFile ¶ added in v0.0.4
IsRegularFile tells whether the filename is a regular file
func ReadJsonFileIntoVar ¶ added in v0.0.9
func ToTrimString ¶ added in v0.0.9
func WriteFileAtomic ¶ added in v0.0.4
Write file to temp and atomically move when everything else succeeds.
func WritePidFile ¶ added in v0.0.9
func WritePidFile(pidFile ...string)
WritePidFile writes the current PID to the specified file.
func WriteValueToJsonFile ¶ added in v0.0.9
Types ¶
type SectionWriter ¶ added in v0.0.4
type SectionWriter struct {
// contains filtered or unexported fields
}
func NewSectionWriter ¶ added in v0.0.4
func NewSectionWriter(w io.WriterAt, off int64, n int64) *SectionWriter
func (*SectionWriter) Seek ¶ added in v0.0.4
func (s *SectionWriter) Seek(offset int64, whence int) (int64, error)
func (*SectionWriter) Size ¶ added in v0.0.4
func (s *SectionWriter) Size() int64
Size returns the size of the section in bytes.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.