system

package
v0.0.0-...-a42ca26 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFileToTar

func AddFileToTar(archive *tar.Writer, dir string, file string) error

AddFileToTar adds a file/folder to a tar.Writer.

func AddFileToZip

func AddFileToZip(archive *zip.Writer, dir string, file string, compress bool) error

AddFileToZip adds a file or folder to a zip.Writer using Deflate.

func CanDeleteFolder

func CanDeleteFolder(path string) (int, string)

CanDeleteFolder checks if a folder can be deleted, checking its children recursively.

func Copy

func Copy(fromMode fs.FileMode, path string, dest string) error

Copy copies a file, symlink or folder from one place to another atomically.

func CopyDirectory

func CopyDirectory(path string, dest string) error

CopyDirectory copies a folder from one place to another. Requires the destination path to exist already.

func CopyFile

func CopyFile(path string, dest string) error

CopyFile copies a file from one place to another.

func CopySymLink(source, dest string) error

CopySymlink copies a symlink from one place to another.

func ExtractTarFile

func ExtractTarFile(tarFile string, location string) error

ExtractTarFile extracts a tar archive to a location. It supports gzip and bzip2 natively, and xz/zstd if installed on your system on the CLI.

func GetTotalSystemMemory

func GetTotalSystemMemory() uint64

GetTotalSystemMemory gets the total system memory in the current system.

func IsFileLocked

func IsFileLocked(_ error) bool

IsFileLocked checks if a file is locked.

func NativeCompressionReader

func NativeCompressionReader(r io.Reader, algorithm string) io.ReadCloser

NativeCompressionReader can use xz/zstd installed in your system PATH for decompression.

func NativeCompressionWriter

func NativeCompressionWriter(w io.Writer, algorithm string) io.WriteCloser

NativeCompressionWriter can use xz/zstd installed in your system PATH for compression. It uses zstd long distance mode for better compression.

func UnzipFile

func UnzipFile(zipFile string, location string) error

UnzipFile unzips a file to a location.

Types

type ProcessStats

type ProcessStats struct {
	CPUUsage  float64
	RSSMemory float64
}

ProcessStats is statistics of a process.

func GetProcessStats

func GetProcessStats(pid int) (ProcessStats, error)

GetProcessStats gets the stats of a process.

type Stat

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

Stat will store CPU time struct

Jump to

Keyboard shortcuts

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