nativefiles

package
v0.448.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

README

natfivefiles package

Handle local files and directories in a go native way.

Examples

For developers

To run tests use:

bash -c "cd $(git rev-parse --show-toplevel) && go test -v ./pkg/filesutils/nativefiles/..."

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chmod added in v0.440.0

func Chmod(ctx context.Context, path string, options *filesoptions.ChmodOptions) error

func Contains added in v0.448.0

func Contains(ctx context.Context, filePath string, searchString string) (bool, error)

func Create

func Create(ctx context.Context, path string) error

func CreateDirectory added in v0.418.0

func CreateDirectory(ctx context.Context, path string) error
func CreateSymlink(ctx context.Context, target string, symlink string) error

func Delete

func Delete(ctx context.Context, pathToDelete string, options *filesoptions.DeleteOptions) error

Delete a file or directory. Directories are deleted recursively.

func Exists

func Exists(ctx context.Context, pathToCheck string) bool

func GetAccessPermissions added in v0.440.0

func GetAccessPermissions(path string) (int, error)

func GetAccessPermissionsString added in v0.440.0

func GetAccessPermissionsString(path string) (string, error)

func IsDir

func IsDir(ctx context.Context, pathToCheck string) bool

func IsFile

func IsFile(ctx context.Context, pathToCheck string) bool
func IsSymlink(ctx context.Context, pathToCheck string) (bool, error)

func IsSymlinkTo added in v0.448.0

func IsSymlinkTo(ctx context.Context, symlink string, target string) (bool, error)

func IsSymlinkToDirectory added in v0.448.0

func IsSymlinkToDirectory(ctx context.Context, pathToCheck string) (bool, error)

func ListFiles added in v0.442.0

func ListFiles(ctx context.Context, path string, listOptions *parameteroptions.ListFileOptions) ([]string, error)

func ReadAsBytes added in v0.408.0

func ReadAsBytes(ctx context.Context, pathToRead string) ([]byte, error)

func ReadAsString

func ReadAsString(ctx context.Context, pathToRead string) (string, error)
func ResolveSymlink(ctx context.Context, symlink string) (string, error)

func SecureDelete

func SecureDelete(ctx context.Context, path string) error

Overwrite the file before deleting it to prevent data restore. Like 'shred' on linux systems.

func WriteBytes added in v0.408.0

func WriteBytes(ctx context.Context, pathToWrite string, content []byte) error

func WriteString

func WriteString(ctx context.Context, pathToWrite string, content string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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