Documentation ¶
Index ¶
- Constants
- Variables
- func BufferCat(sv ...string) []byte
- func ByteCat(sv ...[]byte) string
- func DecodeUID(glid string) int64
- func Du(path string) (int64, error)
- func ErrorCat(sv ...string) error
- func ExpandPath(path string) string
- func HumanateSize(s int64) string
- func HumanateSizeU(s uint64) string
- func NewRID() string
- func NewRandomString(length int) string
- func NewToken() string
- func ParseDuration(s string) (time.Duration, error)
- func ParseKID(glid string) (int64, error)
- func ParseSize(data string) (int64, error)
- func ParseUID(glid string) (int64, error)
- func Remove(name string) error
- func Rename(oldpath, newpath string) error
- func ResolveSymbolicLink(path string) (string, error)
- func SimpleAtob(s string, dv bool) bool
- func SplitPath(p string) []string
- func StrCat(sv ...string) string
- func StrSplitSkipEmpty(s string, sep byte, suggestcap int) []string
- type DiskFreeSpace
- type LimitWriter
- type RID
- type Token
Constants ¶
const ( FilesystemSuperMagicTmpfs = 0x01021994 FilesystemSuperMagicExt4 = 0xEF53 FilesystemSuperMagicXfs = 0x58465342 FilesystemSuperMagicNfs = 0x6969 FilesystemSuperMagicZfs = 0x2fc12fc1 // FilesystemSuperMagicBtrfs is the 64bit magic for Btrfs // we not support 32bit system FilesystemSuperMagicBtrfs = 0x9123683E FilesystemSuperMagicCGroup = 0x27e0eb FilesystemSuperMagicCGroup2 = 0x63677270 FilesystemSuperMagicNTFS = 0x5346544e FilesystemSuperMagicEXFAT = 0x2011BAB0 FilesystemSuperMagicCEPH = 0x00c36400 FilesystemSuperMagicOverlayFS = 0x794c7630 // https://developer.apple.com/support/downloads/Apple-File-System-Reference.pdf FilesystemSuperMagicAPFS = 0x42535041 // BSPA )
const ( Byte int64 = 1 << (iota * 10) KiByte MiByte GiByte TiByte PiByte EiByte )
const (
SystemBlockSize int64 = 512
)
Variables ¶
var ( ZeroRID RID // empty RID, all zeros ZeroToken Token )
var s
var ( ErrNotUserID = errors.New("not user id") ErrNotKeyID = errors.New("not key id") )
var (
ErrDangerousRepoPath = errors.New("dangerous or unreachable repository path")
)
var (
ErrSyntaxSize = errors.New("size synatx error")
)
Functions ¶
func ByteCat ¶
ByteCat cat strings: You should know that StrCat gradually builds advantages only when the number of parameters is> 2.
func ExpandPath ¶
ExpandPath is a helper function to expand a relative or home-relative path to an absolute path.
eg. ~/.someconf -> /home/alec/.someconf
func HumanateSize ¶
func HumanateSizeU ¶
func NewRandomString ¶
func ParseDuration ¶
ParseDuration parses a duration string. A duration string is a possibly signed sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h", "d", "w".
func ResolveSymbolicLink ¶
ResolveSymbolicLink will follow any symbolic links
func SimpleAtob ¶
Types ¶
type DiskFreeSpace ¶
func GetDiskFreeSpaceEx ¶
func GetDiskFreeSpaceEx(mountPath string) (*DiskFreeSpace, error)
type LimitWriter ¶
type LimitWriter struct {
// contains filtered or unexported fields
}
func NewLimitWriter ¶
func NewLimitWriter(dst io.Writer, limit int) *LimitWriter
NewLimitWriter create a new LimitWriter that accepts at most 'limit' bytes.
type RID ¶
type RID [16]byte
RID type
func NewRandomFromReader ¶
NewRandomFromReader returns a UUID based on bytes read from a given io.Reader.