Documentation
¶
Index ¶
- Constants
- func CheckNotExist(src string) bool
- func CheckPermission(src string) bool
- func CommonPrefix(sep byte, paths ...string) string
- func CopyDir(src string, dst string, style string) error
- func CopyFile(src, dst, style string) error
- func CopySingleFile(src, dst, style string) error
- func CreateFile(path string) error
- func CreateFileAndWriteContent(path string, content string) error
- func DirSizeB(path string) (int64, error)
- func Exists(path string) bool
- func FindFirstFile(root string, filename string) string
- func GetCompressionAlgorithm(t string) (string, archives.ArchiverAsync, error)
- func GetExt(fileName string) string
- func GetFileOrDirSize(path string) (int64, error)
- func GetNoDuplicateFileName(fullPath string) string
- func GetSize(f multipart.File) (int, error)
- func IsBrokenSymlink(path string) (bool, error)
- func IsDir(path string) bool
- func IsDirEmpty(name string) (bool, error)
- func IsFile(path string) bool
- func IsNotExistCreateFile(src string) error
- func IsNotExistMkDir(src string) error
- func MkDir(src string) error
- func MoveFile(sourcePath, destPath string) error
- func MustOpen(fileName, filePath string) (*os.File, error)
- func NameAccumulation(path string) string
- func Open(name string, flag int, perm os.FileMode) (*os.File, error)
- func ParseFile(filename string) (lines []string, err error)
- func ParseLine(line string, sep string) (key string, value string, err error)
- func RMDir(src string) error
- func ReadFile(filename string) (osrelease map[string]string, err error)
- func ReadFullFile(path string) []byte
- func ReadOSRelease() (osrelease map[string]string, err error)
- func SpliceFiles(dir, path string, length int, startPoint int) error
- func WriteArchive(ctx context.Context, w io.Writer, format archives.ArchiverAsync, ...) error
- func WriteToFullPath(data []byte, fullPath string, perm fs.FileMode) error
- func WriteToPath(data []byte, path, name string) error
Constants ¶
const EtcOsRelease string = "/etc/os-release"
about os release
const UsrLibOsRelease string = "/usr/lib/os-release"
Variables ¶
This section is empty.
Functions ¶
func CheckPermission ¶
CheckPermission check if the file has permission
func CommonPrefix ¶
func CopySingleFile ¶
*
- @description:
- @param {*} src
- @param {*} dst
- @param {string} style
- @return {*}
- @method:
- @router:
func CreateFile ¶
func FindFirstFile ¶
func GetCompressionAlgorithm ¶
func GetCompressionAlgorithm(t string) (string, archives.ArchiverAsync, error)
GetCompressionAlgorithm returns the file extension and the archiver for a download format, to hand to WriteArchive.
func GetFileOrDirSize ¶
func GetNoDuplicateFileName ¶
Check for duplicate file names
func IsBrokenSymlink ¶
func IsDirEmpty ¶
func IsNotExistCreateFile ¶
IsNotExistMkDir create a directory if it does not exist
func IsNotExistMkDir ¶
IsNotExistMkDir create a directory if it does not exist
func NameAccumulation ¶
func ReadFullFile ¶
func ReadOSRelease ¶
Read and return os-release, trying EtcOsRelease, followed by UsrLibOsRelease. err will contain an error message if neither file exists or failed to parse
func WriteArchive ¶ added in v0.4.26
func WriteArchive(ctx context.Context, w io.Writer, format archives.ArchiverAsync, commonPath string, paths []string) error
WriteArchive streams to w an archive, in format, of paths, each of which is commonPath or lies under it. Entries are written while the paths are walked, so the first bytes go out before the walk ends.
Entries are named after the last element of commonPath followed by their place under commonPath; directories end with '/'. A selected commonPath that is a directory gets no entry of its own, only its contents; one that is a file is archived under its name. A selected symlink is followed, since the user picked it: its target is archived under the link's name. Inside a selected directory, symlinks are stored as symlinks and never followed; devices, pipes and sockets are skipped.
Any failure is an error: a path that is missing or unreadable, a file that changed while it was archived, a write to w or its final flush, or ctx being done. After an error nothing more is written to w, so the archive is left unterminated rather than looking complete.
func WriteToPath ¶
Types ¶
This section is empty.