Documentation ¶
Index ¶
- func AppendToFile(filePath string, newContent string) error
- func ByteToBase64(b []byte) string
- func Copy(srcFile, dstFile string) error
- func CopyDirectory(scrDir string, dest string, ignoreList []string) error
- func CopySymLink(source, dest string) error
- func CreateDirIfNotExists(dir string, perm os.FileMode) error
- func DownloadFileToBase64(fileURL string, includeDataPrefix bool) (string, error)
- func DownloadFileToBytes(fileURL string) ([]byte, error)
- func DownloadFileToDisk(diskFilePath string, diskFileName, fileURL string, ...) (string, string, error)
- func DownloadFileToFile(fileURL string) (*os.File, error)
- func FileExists(filePath string) bool
- func FindFirstFileInFolderContainingText(folderPath string, subStr string) (string, error)
- func GetDirFilesFlat(scrDir string) ([]string, error)
- func InsertTextInFile(filePath string, toBeInserted string, landmark string, after bool) error
- func ReadCsvFile(filePath string) ([][]string, error)
- func ReadFileToBase64NoError(filePath string) string
- func ReplaceTextInFile(filePath string, oldText string, newText string) error
- func WriteCsvFile(content [][]string, filename string) error
- type NotFoundError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendToFile ¶
Adds new text to the bottom of the file and writes it back to the disk
func CopyDirectory ¶
Copies a directory and its nested folders
func CreateDirIfNotExists ¶
Creates a directory if doesn't exist
func DownloadFileToBase64 ¶
Downloads the file from `fileURL` and converts it into base64
The base64 can have a prefix, e.g. `data:image/jpeg;base64,`
This prefix can be omitted or included using `includeDataPrefix`
func DownloadFileToBytes ¶
Downloads the file from `fileURL` and converts it into bytes
func DownloadFileToDisk ¶
func DownloadFileToDisk(diskFilePath string, diskFileName, fileURL string, chmodPermission *fs.FileMode) (string, string, error)
Downloads the file from `fileURL` and writes to the disk
The new file will be named as `diskFileName` and will be saved to `diskFilePath`
If the permission of the file should be changed, it can be passes as `chmodPermission`, e.g. 0777 The return values are -> (file name, file path, error)
func DownloadFileToFile ¶ added in v0.1.2
Downloads a file from `fileURL` and converts it into a temporary `os.File`
func FindFirstFileInFolderContainingText ¶
Finds the first file in a folder (and its children) that contains a text
func GetDirFilesFlat ¶
Collects all of the files of the given directory and its nested folders.
The paths to all of the files will return in a flat array
func InsertTextInFile ¶
Inserts a text in a file after a landmark text
func ReadCsvFile ¶
Reads a CSV files and converts to an array of array of strings
func ReadFileToBase64NoError ¶
Reads a file from the disk and converts to the base64
This function does not return any error. if any errors, it returns an empty string
func ReplaceTextInFile ¶
Replaces a certain text in a file and writes it back to the disk
func WriteCsvFile ¶ added in v0.1.2
Receives the content of the CSV file as a slice of string slice and writes it to file
Types ¶
type NotFoundError ¶
type NotFoundError struct {
Target string
}
func (*NotFoundError) Error ¶
func (m *NotFoundError) Error() string