package
1.0.5
Repository: https://github.com/vnhacker1337/go-toolkit.git
Documentation: pkg.go.dev

# README

fileutil

The package contains various helpers to interact with files

# Functions

CleanPath cleans paths to migtigate any possible path traversal attacks.
CleanPathOrDefault cleans paths to migtigate any possible path traversal attacks.
CopyFile from source to destination.
CountLines counts the lines in a file.
CountLinesWithOptions from a reader and custom filter function.
CountLinesWithSeparator of a file.
CreateFolder path.
CreateFolders in the list.
No description provided by the author
DownloadFile to specified path.
No description provided by the author
FileExists checks if the file exists in the provided path.
FileExistsIn checks if the file exists in the allowed paths.
FileOrFolderExists checks if the file/folder exists.
FileSizeToByteLen converts a file size with units(kb, mb, gb, tb) to byte length e.g.
FixMissingDirs creates any missing directories in chain /path/to/file.
FolderExists checks if the folder exists.
GetTempFileName generate a temporary file name.
HasPermission checks if the file has the requested permission.
HasStdin determines if the user has piped input.
IsReadable verify file readability.
IsWriteable verify file writeability.
No description provided by the author
No description provided by the author
OpenOrCreate opens the named file for reading.
ReadFile with filename.
ReadFile with filename and specific buffer size.
ReadFileWithReader and stream on a channel.
ReadFileWithReader with specific buffer size and stream on a channel.
RemoveAll specified paths, returning those that caused error.
ResolveNClean resolves the path and cleans it ex: a nuclei template can be either abs or relative to a specified directory this function uses given path as a base to resolve the path instead of cwd.
ResolveNCleanOrDefault resolves the path and cleans it.
SafeOpen opens a file after cleaning the path in read mode.
SafeOpenAppend opens a file after cleaning the path in append mode and creates any missing directories in chain /path/to/file.
SafeOpenWrite opens a file after cleaning the path in write mode and creates any missing directories in chain /path/to/file.
SafeWriteFile writes data to a file after cleaning the path in write mode and creates any missing directories in chain /path/to/file.
SubstituteConfigFromEnvVars reads a config file and generates a reader with substituted config values from environment variables.
No description provided by the author
No description provided by the author
UseMusl checks if the specified elf file uses musl.

# Constants

No description provided by the author
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
IsNotEmpty determines if a data chunk is empty.
No description provided by the author

# Structs

No description provided by the author

# Type aliases

No description provided by the author