Documentation
¶
Index ¶
- func ByteCountIEC(b int64) string
- func CountTCPConnections(pid uint32) int
- func CountUDPConnections(pid uint32) int
- func DeleteFiles(files []string)
- func DownloadFile(ctx context.Context, url string) (filename, mediaType string, data []byte, err error)
- func FileExists(path string) bool
- func FileNameWithoutExt(path string) string
- func FindLogFiles(path string) ([]string, []time.Time, error)
- func GetMapWithoutPrefix(set map[string]string, prefix string) map[string]string
- func GetOrElse(s string, def string) string
- func IsDirectory(path string) (bool, error)
- func MoveSlice[S ~[]E, E any](s S, i, j int)
- func PruneByTag(in interface{}, value string, tag string) (interface{}, error)
- func RandToken(n int) (string, error)
- func ReadFileLines(path string, offset int64, n int) ([]string, int, int64, error)
- func RuneSizeInString(s string) []int
- func SplitExt(path string) (string, string)
- func ZipFiles(filename string, files map[string]string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteCountIEC ¶ added in v1.22.0
ByteCountIEC converts a size in bytes to a human-readable string in IEC (binary) format.
func CountTCPConnections ¶ added in v1.22.0
CountTCPConnections returns the number of connected TCP endpoints for a given process.
func CountUDPConnections ¶ added in v1.22.0
CountUDPConnections returns the number of UDP endpoints for a given process.
func DeleteFiles ¶
func DeleteFiles(files []string)
DeleteFiles removes the given file list ignoring errors
func DownloadFile ¶ added in v1.9.0
func DownloadFile(ctx context.Context, url string) (filename, mediaType string, data []byte, err error)
DownloadFile downloads a file from the given url
func FileExists ¶
FileExists checks whether the given path is a file
func FileNameWithoutExt ¶ added in v1.20.0
FileNameWithoutExt returns the last element of path without the file extension.
func FindLogFiles ¶
FindLogFiles returns the files and dates archived by date
func GetMapWithoutPrefix ¶ added in v1.16.0
func GetOrElse ¶ added in v1.7.1
GetOrElse returns the given string if it's non-empty, or returns the default string.
func IsDirectory ¶ added in v1.8.0
IsDirectory determines if a file represented by `path` is a directory or not
func PruneByTag ¶
PruneByTag returns a copy of "in" that only contains fields with the given tag and value
func ReadFileLines ¶
ReadFileLines reads the last n lines in a file starting at a given offset
func RuneSizeInString ¶ added in v1.9.0
RuneSizeInString returns a slice of each character's size in the given string
Types ¶
This section is empty.