udwFile

package
v0.0.0-...-f254aa5 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2020 License: MIT Imports: 24 Imported by: 28

Documentation

Index

Constants

View Source
const WalkV2RespBreak = 3
View Source
const WalkV2RespNext = 1
View Source
const WalkV2RespSkipDir = 2

Variables

This section is empty.

Functions

func AppendFile

func AppendFile(path string, content []byte) (err error)

func Chmod

func Chmod(filepath string, mode os.FileMode) (err error)

func CopyFile

func CopyFile(src, dst string) (err error)

func Delete

func Delete(path string) (err error)

func ErrorIsDirectory

func ErrorIsDirectory(err error) bool

func ErrorIsFileNotFound

func ErrorIsFileNotFound(err error) bool

func FileExist

func FileExist(path string) (exist bool, err error)

func FileExistIgnoreError

func FileExistIgnoreError(path string) bool

func FileInfoIsDir

func FileInfoIsDir(fi os.FileInfo) bool

func FileInfoIsFile

func FileInfoIsFile(fi os.FileInfo) bool
func FileInfoIsSymlink(fi os.FileInfo) bool
func FileModeIsSymlink(fm os.FileMode) bool

func FileSync

func FileSync(f *os.File) error

func FixedTmpDir

func FixedTmpDir() string

func FullPathOnPath

func FullPathOnPath(workingPath string, path string) string

func GetAllDir

func GetAllDir(root string) ([]string, error)

func GetAllDirOneLevel

func GetAllDirOneLevel(path string) (fileList []string, err error)

func GetAllFiles

func GetAllFiles(root string) (out []string, err error)

func GetExt

func GetExt(path string) string

func GetExtWithoutDot

func GetExtWithoutDot(path string) string

func GetFileBaseWithoutExt

func GetFileBaseWithoutExt(p string) string

func GetFileModifyTime

func GetFileModifyTime(path string) (modeTime time.Time, err error)

func GetFileNameParseUrlv

func GetFileNameParseUrlv(in string) (out string)

func GetFileSize

func GetFileSize(path string) (int64, error)

func GetFileSizeOrZero

func GetFileSizeOrZero(path string) int64

func GetFullPath

func GetFullPath(inPath string) (string, error)

func GetHomeDirPath

func GetHomeDirPath() (string, error)

func GetRelativePath

func GetRelativePath(shortPath string, longPath string) (string, error)

func GetSamePrefixPath

func GetSamePrefixPath(shortPath string, longPath string) string

func GetTempDir

func GetTempDir() string

func HasExt

func HasExt(path string, ext string) bool

func IsDangerFullPath

func IsDangerFullPath(thisPath string) bool

func IsDotFile

func IsDotFile(path string) bool

func IsExtInList

func IsExtInList(fileName string, extList []string) (isExtInList bool)
func IsSymlink(path string) bool

func Mkdir

func Mkdir(path string) (err error)

func MkdirForFile

func MkdirForFile(path string) (err error)

func MkdirForFile777

func MkdirForFile777(path string) (err error)

func MustAppendFile

func MustAppendFile(path string, content []byte)

func MustAppendFileAddLineEnd

func MustAppendFileAddLineEnd(path string, content []byte)

func MustChangeDir

func MustChangeDir(dir string)

func MustChangeToTmpPath

func MustChangeToTmpPath() string

func MustChdir

func MustChdir(dir string)

func MustCheckContentAndWriteFileWithMkdir

func MustCheckContentAndWriteFileWithMkdir(path string, content []byte)

func MustCheckContentAndWriteFileWithMkdirWithCorrectFold

func MustCheckContentAndWriteFileWithMkdirWithCorrectFold(path string, content []byte)

func MustCheckContentAndWriteVFileItemList

func MustCheckContentAndWriteVFileItemList(basePath string, vfileSet []VFileItem)

func MustCheckContentCopyWithoutMerge

func MustCheckContentCopyWithoutMerge(src, dst string)

func MustChmod

func MustChmod(filepath string, mode os.FileMode)

func MustCopy

func MustCopy(src string, dst string)

func MustCopyFile

func MustCopyFile(src, dst string)

func MustCopyFileIgnoreNotExist

func MustCopyFileIgnoreNotExist(src, dst string)

func MustCopyV2

func MustCopyV2(req MustCopyV2Request)

func MustCopyWithFilter

func MustCopyWithFilter(src string, dst string, filter func(fullpath string) bool)

func MustDelete

func MustDelete(path string)

func MustDeleteFile

func MustDeleteFile(path string)

func MustDeleteFileOrDirectory

func MustDeleteFileOrDirectory(path string)

func MustDirectoryExist

func MustDirectoryExist(path string) bool

func MustEnsureBinPath

func MustEnsureBinPath(finalPath string)

func MustEnsureDir777

func MustEnsureDir777(path string)

func MustFileContainsString

func MustFileContainsString(path string, toSearchString string) bool

func MustFileExist

func MustFileExist(path string) bool

func MustFileSystemItemInfoEqual

func MustFileSystemItemInfoEqual(a StatAndFullPath, b StatAndFullPath) bool

func MustFileWalk

func MustFileWalk(root string, fn func(ctx *WalkContext))

func MustGetAllDir

func MustGetAllDir(root string) (out []string)
func MustGetAllDirFollowSymlink(root string) (dirList []string)

func MustGetAllDirOneLevel

func MustGetAllDirOneLevel(path string) (fileList []string)

func MustGetAllDirSort

func MustGetAllDirSort(root string) (out []string)
func MustGetAllFileAndDirAndSymlink(root string) (out []string)
func MustGetAllFileFollowSymlink(root string) (fileList []string)

func MustGetAllFileFromPathList

func MustGetAllFileFromPathList(pathlist []string) (outList []string)

func MustGetAllFileOneLevel

func MustGetAllFileOneLevel(path string) (fileList []string)

func MustGetAllFiles

func MustGetAllFiles(root string) (out []string)

func MustGetAllFilesSort

func MustGetAllFilesSort(root string) (out []string)

func MustGetAllSymlinkPathList

func MustGetAllSymlinkPathList(path string) (out []string)

func MustGetDirectorySize

func MustGetDirectorySize(path string) int64

func MustGetFileModifyTime

func MustGetFileModifyTime(path string) (modeTime time.Time)

func MustGetFileOrDirectoryNameWithRealFold

func MustGetFileOrDirectoryNameWithRealFold(path string) string

func MustGetFilePerm

func MustGetFilePerm(path string) os.FileMode

func MustGetFileSize

func MustGetFileSize(path string) int64

func MustGetFullPath

func MustGetFullPath(inPath string) string

func MustGetHomeDirPath

func MustGetHomeDirPath() string

func MustGetRelativePath

func MustGetRelativePath(shortPath string, longPath string) string

func MustGetWd

func MustGetWd() string

func MustIsDir

func MustIsDir(filepath string) bool

func MustIsFile

func MustIsFile(filepath string) bool

func MustIsFileOrDirectoryNameFoldCorrect

func MustIsFileOrDirectoryNameFoldCorrect(path string) bool

func MustMkdir

func MustMkdir(dirname string)

func MustMkdir777

func MustMkdir777(path string)

func MustMkdirAll

func MustMkdirAll(dirname string)

func MustMkdirForFile

func MustMkdirForFile(path string)

func MustMkdirForFile777

func MustMkdirForFile777(path string)

func MustMove

func MustMove(srcPath string, dstPath string)

func MustMoveNameFoldCorrect

func MustMoveNameFoldCorrect(fromPath string, toPath string)

func MustOnlyFileExist

func MustOnlyFileExist(path string) bool

func MustReadDirFileOneLevel

func MustReadDirFileOneLevel(path string) (fileList []string)

func MustReadFile

func MustReadFile(path string) (content []byte)

func MustReadFileAll

func MustReadFileAll(path string) (content []byte)

func MustReadFileAtStartPosWithLen

func MustReadFileAtStartPosWithLen(path string, startPos int64, thisLen int64) (content []byte)

func MustReadFileOrIgnore

func MustReadFileOrIgnore(path string) (content []byte)

func MustReadFileToBufW

func MustReadFileToBufW(path string, bufW *udwBytes.BufWriter)
func MustReadSymlink(path string) string

func MustRealPath

func MustRealPath(inPath string) string

func MustRename

func MustRename(oldpath string, newpath string)

func MustSetWd

func MustSetWd(workdingDirectory string)
func MustSymlink(realPath string, linkPath string)

func MustSymlinkFullPath

func MustSymlinkFullPath(realPath string, linkPath string)

func MustSymlinkRel

func MustSymlinkRel(realPath string, linkPath string)

func MustWalkV2

func MustWalkV2(root string, cb func(st StatAndFullPath) int)

func MustWriteFile

func MustWriteFile(path string, content []byte)

func MustWriteFileAndMove

func MustWriteFileAndMove(req WriteFileAndMoveReq)

func MustWriteFileWithMkdir

func MustWriteFileWithMkdir(path string, content []byte)

func NewTmpFilePath

func NewTmpFilePath() string

func NewTmpFilePathWithExt

func NewTmpFilePathWithExt(ext string) string

func OnlyFileExist

func OnlyFileExist(path string) (exist bool, err error)

func PathBaseWithoutExt

func PathBaseWithoutExt(path string) string

func PathClean

func PathClean(path string) string

func PathTrimExt

func PathTrimExt(path string) string

func ReadDir

func ReadDir(dirname string) ([]os.FileInfo, error)

func ReadDirFileOneLevel

func ReadDirFileOneLevel(path string) (fileList []string, err error)

func ReadFile

func ReadFile(path string) (content []byte, err error)

func ReadFileAll

func ReadFileAll(path string) (content []byte, err error)

func ReadFileToBufW

func ReadFileToBufW(path string, bufW *udwBytes.BufWriter) (err error)

func Realpath

func Realpath(inPath string) (string, error)

func RemoveExtFromFilePath

func RemoveExtFromFilePath(path string) string

func SearchFileInParentDir

func SearchFileInParentDir(startDirPath string, fileName string) (file string, err error)

func SymlinkIsDirectory

func SymlinkIsDirectory(path string) bool

func TailByte

func TailByte(filePath string, size int64) (content []byte, err error)

func TruncateFileToAimSizeFromEnd

func TruncateFileToAimSizeFromEnd(filePath string, length int64) (err error)

func VFileSetAddDirPath

func VFileSetAddDirPath(basePath string, vfileSet []VFileItem)

func VFileSetSort

func VFileSetSort(vfileSet []VFileItem)

func WriteFile

func WriteFile(path string, content []byte) (err error)

func WriteFileAndMove

func WriteFileAndMove(req WriteFileAndMoveReq) (err error)

func WriteFileWithMkdir

func WriteFileWithMkdir(path string, content []byte) (err error)

Types

type DirectoryFileTransform

type DirectoryFileTransform struct {
	InputExt     string
	OuputExt     string
	IsIgnoreFile func(path string) bool
	Transform    func(r io.Reader, w io.Writer) error
}

func (*DirectoryFileTransform) Run

func (transform *DirectoryFileTransform) Run(inputPath string, outputPath string) error

type MustCopyV2Request

type MustCopyV2Request struct {
	Src             string
	Dst             string
	IsCopyFilter    func(stat StatAndFullPath) bool
	AfterCopyFilter func(before StatAndFullPath, afterPath string) bool
}

type PathAndContentPair

type PathAndContentPair struct {
	Path    string
	Content []byte
}

type StatAndFullPath

type StatAndFullPath struct {
	Fi       os.FileInfo
	FullPath string
}

func GetAllFileAndDirectoryStat

func GetAllFileAndDirectoryStat(root string) (out []StatAndFullPath, err error)

func GetAllFileAndDirectoryStatWithFilter

func GetAllFileAndDirectoryStatWithFilter(root string, filter func(path string, info os.FileInfo) bool) (out []StatAndFullPath, err error)

func MustGetAllFileAndDirectoryStat

func MustGetAllFileAndDirectoryStat(root string) (out []StatAndFullPath)

func MustGetAllFileAndStatOneLevel

func MustGetAllFileAndStatOneLevel(path string) (fileAndStatList []StatAndFullPath)

func MustGetAllStatAndFullPathOneLevel

func MustGetAllStatAndFullPathOneLevel(path string) (fileAndStatList []StatAndFullPath)

type VFileItem

type VFileItem struct {
	Path    string
	Content []byte
	Hash    string
}

type WalkContext

type WalkContext struct {
	StatAndFullPath
	// contains filtered or unexported fields
}

func (*WalkContext) GetRelPath

func (ctx *WalkContext) GetRelPath() string

func (*WalkContext) SkipDir

func (ctx *WalkContext) SkipDir()

func (*WalkContext) StopWalk

func (ctx *WalkContext) StopWalk()

type WriteFileAndMoveReq

type WriteFileAndMoveReq struct {
	TmpDir     string
	TargetPath string
	Content    []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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