file

package
v0.0.0-...-6065391 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFileBytes

func AppendFileBytes(targetPath string, addData []byte) error

AppendFileBytes takes a file and adds a byte array to the end of it

func AppendFileString

func AppendFileString(targetPath, addString string) error

AppendFileString takes a file and adds a string to the end of it

func CheckExists

func CheckExists(targetPath string) bool

CheckExists takes a file or directory and checks to see if it exists on the file system

func CopyFile

func CopyFile(srcPath, destPath string) (int, error)

CopyFile copies a file from the src to the dest with the original files permissions

func ReadFileAsBytes

func ReadFileAsBytes(readPath string) ([]byte, error)

ReadFileAsBytes takes a file path and reads that files contents and returns a byte array of the contents

func ReadFileAsString

func ReadFileAsString(readPath string) (string, error)

ReadFileAsString takes a file path and reads that files contents and returns a string representation of the contents

func ReplaceInFileWithRegex

func ReplaceInFileWithRegex(file string, regexString string, replaceWith string) (int, error)

ReplaceInFileWithRegex searches a file for a string and replaces each instance found of that string. Returns the amount of strings replaced

func ReplaceInFileWithString

func ReplaceInFileWithString(file, match, replacement string) (int, error)

ReplaceInFileWithString searches a file for a string and replaces each instance found of that string. Returns the amount of strings replaced

func SetPerms

func SetPerms(targetPath string, perms int64) error

SetPerms changes the file permissions of a givin file

func WriteFileFromBytes

func WriteFileFromBytes(destPath string, fileData []byte) error

WriteFileFromBytes writes data from a byte array to a dest filepath with the dest parent dirs permissions.

func WriteFileFromString

func WriteFileFromString(destPath string, fileData string) error

WriteFileFromString writes data from a string to a dest filepath with the dest parent dirs permissions.

Types

This section is empty.

Jump to

Keyboard shortcuts

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