osutil

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MaxFileBytes int64 = 256 * 1024 * 1024 // 256 MiB

MaxFileBytes is the maximum file bytes. When used, the value should be strictly less than this number.

Functions

func CopyFromReaderToDir added in v1.1.0

func CopyFromReaderToDir(src io.Reader, dst string, perm fs.FileMode) error

CopyFromReaderToDir copies file from src to dst where dst is the destination file path.

func CopyToDir

func CopyToDir(src, dst string) (int64, error)

CopyToDir copies the src file to dst. Existing file will be overwritten.

func DetectFileType added in v1.1.0

func DetectFileType(path string) (string, error)

DetectFileType returns a file's content type given path

func IsRegularFile

func IsRegularFile(path string) (bool, error)

IsRegularFile checks if path is a regular file

func ValidateSHA256Sum added in v1.1.0

func ValidateSHA256Sum(path string, checksum string) error

ValidateSHA256Sum returns nil if SHA256 of file at path equals to checksum.

func WriteFile

func WriteFile(path string, data []byte) error

WriteFile writes to a path with all parent directories created.

func WriteFileWithPermission

func WriteFileWithPermission(path string, data []byte, perm fs.FileMode, overwrite bool) error

WriteFileWithPermission writes to a path with all parent directories created.

Types

This section is empty.

Jump to

Keyboard shortcuts

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