fileutils

package
v0.0.81 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2022 License: MIT Imports: 17 Imported by: 12

Documentation

Overview

Package fileutils provided a set of method for work with files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareBinaryFile added in v0.0.25

func CompareBinaryFile(file1, file2 string, nByte int) bool

CompareBinaryFile is delegated to compare two files using chunks of byte

func CountLines added in v0.0.31

func CountLines(fileName, separator string, bufferLength int) (int, error)

CountLines return the number of lines in the given file If called with an empty separator, new line will be used as default

func CreateDir added in v0.0.18

func CreateDir(path string) error

CreateDir is delegated to create a new directory if not present

func ExtractWordFromFile added in v0.0.23

func ExtractWordFromFile(filename string) map[string]int

ExtractWordFromFile is delegated to extract the word from a given file with the related frequencies

func FileExists added in v0.0.7

func FileExists(filename string) bool

FileExists verify that the file exist

func FilterFromFile added in v0.0.18

func FilterFromFile(filename, target string, ignorecase bool) []string

FilterFromFile is delegated to retrieve the lines that contain the target

func FindFiles

func FindFiles(path, target string, caseSensitive bool) []string

FindFiles is delegated to find the files from the given directory, recursively for each dir, and extract only the one that match the input

func GetFileContentType added in v0.0.5

func GetFileContentType(fileName string) (string, error)

GetFileContentType is delegated to retrieve the filetype for a given file path

func GetFileDate

func GetFileDate(filepath string) string

GetFileDate is delegated to return the date in a string format in which the file was (latest) modified

func GetFileModification

func GetFileModification(filepath string) int64

GetFileModification return the last modification time of the file in input in a UNIX time format

func GetFileSize added in v0.0.11

func GetFileSize(filepath string) (int64, error)

GetFileSize is delegated to return the bytes size of the given file

func GetFileSize2 added in v0.0.11

func GetFileSize2(filepath string) (int64, error)

GetFileSize2 is a less efficient method for calculate the file size

func IsDir

func IsDir(path string) bool

IsDir is delegated to verify that the given path is a directory

func IsFile

func IsFile(path string) bool

IsFile verify if the given filepath is a file

func ListFiles added in v0.0.76

func ListFiles(path string) ([]string, error)

ListFiles is delegated to find the files from the given directory, recursively for each dir

func ListFilesOrdered added in v0.0.76

func ListFilesOrdered(path string) ([]string, error)

func Move added in v0.0.64

func Move(source, dest string) error

func ReadFileInArray

func ReadFileInArray(filePath string) []string

ReadFileInArray is delegated to read the file content as tokenize the data by the new line

func Tail added in v0.0.21

func Tail(FILE string, BUFF_BYTE int64, START_POS, N_STRING int) (string, error)

Tail is delegated to read the latest lines of the file. NOTE: buffer have to be lesser than the minimum string length

func VerifyFilesExists

func VerifyFilesExists(filePath string, files []string) bool

VerifyFilesExists is delegated to verify that the given list of file exist in the directory

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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