# README
osutil

The os package of the std packages of Go does not support some functionality which is then implemented over and over again in a lot of projects. One example is to copy a file. This looks simple at first but is very complicated if everything has to be done right (e.g. permissions, ACLs, attributes, ...). osutil handles the simple cases which can be done right. If you have any ideas on how to improve this package or have problems of any kind with it, please submit an issue through the issue tracker.
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
ActivityIndicator prints a spinning activity indicator to the given stream until the indicator is stopped.
AnySliceToTypeSlice returns a slice of the designated type with the values from the given "any" slice that match the type.
AppendToFile opens the named file.
BatchFileExtension returns the common file extension of a batch file.
BinaryExtension returns the common file extension of a binary.
CacheObjectRead reads data with the given unique identifier and type from the cache.
CacheObjectWrite write data with the given unique identifier and type to the cache.
CanonicalizeAndEvaluateSymlinks returns the path after canonicalizing it and the evaluation of any symbolic links.
Capture captures stderr and stdout of a given function call.
Chdir temporarily changes to the given working directory while calling the given function.
ChecksumForPath computes a checksum of a file or directory.
ChecksumsSHA256ForFiles creates checksum-files with SHA-256 recursively for all files in a directory.
CommandFileExtension returns the common file extension of a command file.
CompressDirectory reads the directory srcDirectory and writes a compressed version to archive.
ContextWithInterrupt returns a context which can be interrupted by signals "SIGTERM" and "SIGQUIT".
CopyFile copies a file from src to dst.
CopyFileCompressed reads the file src and writes a compressed version to dst.
CopyTree copies a whole file system tree from the source path to destination path.
DirectoriesRecursive returns all subdirectories of the given path including the given path.
DirectoryPermissionOfParent looks at parent directory of the given path and returns a directory permission based on the permission of the parent.
DirExists checks if a directory exists.
DownloadFile downloads a file from the URL to the file path.
DownloadFileWithProgress downloads a file from the URL to the file path while printing a progress to STDOUT.
EnforceProcessTreeLimits constrains the current process and all descendant processes to the specified limits.
EnvironMap returns a map of the current environment variables.
EnvironmentPathList returns the list of file paths contained in the "PATH" environment variable.
EnvOrDefault returns the environment variable with the given key, or the default value if the key is not defined.
ExtractFile extracts a compressed file to a given path.
FileChange changes the content of a file.
FileExists checks if a file exists while following symlinks.
FileOrSymlinkExists checks if a file exists while not following symlinks.
FilePermissionOfParent looks at parent directory of the given path and returns a file permission based on the permission of the parent.
FilesRecursive returns all files in a given path and its subpaths.
ForEachFile walks through the given path and calls the given callback with every file.
GreatestCommonDirectory computes the greatest common part of the given paths.
Info returns a list of OS relevant information.
IsArchitectureARMWith32Bit returns wheter the operating system runs on ARM with 32 bits.
IsArchitectureARMWith64Bit returns wheter the operating system runs on ARM with 64 bits.
IsArchitectureX86With32Bit returns wheter the operating system runs on x86 with 32 bits.
IsArchitectureX86With64Bit returns wheter the operating system runs on x86 with 64 bits.
IsDarwin returns whether the operating system is Darwin.
IsEnvEnabled checks if the environment variable is enabled.
IsLinux returns whether the operating system is Linux.
IsWindows returns whether the operating system is Windows.
MakeFileCopyTargets copyies Make targets of a Makefile to another Makefile that can have a manually-writen parts until a `# REMARK Do not edit` line.
MkdirAll creates a directory named path, along with any necessary parents, and returns nil, or else returns an error.
No description provided by the author
NewSyncedMap returns a nw synchronized map.
ProgressBar returns a progress bar for counting items with sane defaults that prints its updates to the given writer.
ProgressBarBytes returns a progress bar for counting bytes with sane defaults that prints its updates to the given writer.
RemoveFileIfExists checks if a file exists, and removes the file if it does exist.
RemoveFromEnvironmentPathBySearchTerm returns the content of the "PATH" environment variable where file paths containing the given search terms are removed.
RemoveTemporaryDirectory removes the given temporary directory path from disk with special handling for Windows.
ReplaceVariablesInFile replaces all variables in a file.
RequireEnv returns the environment variable with the given key, or an error if the key is not defined.
RewriteStaticIndexFile rewrites a `github.com/bouk/staticfiles` index file to be extendable by replacing inlined code to common code.
SetRLimitFiles temporarily changes the file descriptor resource limit while calling the given function.
Stat retuns a FileInfo structure describing the given file.
Tar archives a given path into a compressed TAR file.
TarExtract reads the gzip-compressed tar file from the reader and writes it into the destination path.
TarExtractFile extracts a compressed TAR file to a given path.
Uncompress extracts the given archive into the given destination.
ValidateChecksumForPath computes a checksum of a file or directory and returns an error if it does not match the checksum stored in the given file.
WriteChecksumForPath computes a checksum of a file or directory and writes it to the given file.
WriteFile writes the given content into the given file while creating all necessary directories in between.
ZipExtractFile extracts a zipped file to a given path.
# Constants
CompressionTypeGNUZipped indicates a GNU zipped compression.
CompressionTypeNone indicates no compression.
CompressionTypeXZ indicates a XZ compression.
Darwin holds the value of GOOS on MacOS.
EnvironmentPathIdentifier holds the environment variable identifier for the "PATH" variable.
KernelVersionIdentifier holds the identifier for the kernel version OS information.
LineEnding holds the line ending for text files.
Linux holds the value of GOOS on Linux.
OperatingSystemIdentifier holds the identifier for the OS name OS information.
OperatingSystemVersionIdentifier holds the identifier for the OS version OS information.
Windows holds the value of GOOS on Windows.
# Variables
ErrDirectoryNotEmpty indicates that a directory is not empty.
ErrNotADirectory indicates that the given directory does not exist.
ErrNotAFile indicates thate the given file does not exist.
HTTPClient defines an HTTP client with sane default settings.
# Structs
InMemoryStream allows to read and write to an in-memory stream.
ProcessTreeLimits holds limits to apply to the current process's resource usage, including the resource usage of its descendant processes.
StandardStream allows to read from STDIN and write to STDOUT.
StaticFile holds a single file or directory in-memory.
SyncedMap holds a synchronized map.
# Type aliases
CacheObjectType defines a unique type for a cache object.
CompressionType defines the compression type.
FilePathsByHierarchy sorts file paths by their hierarchy.