# README
Defacto2 / helper
Helpers are general system functions used by the Defacto2 server software. See the reference documentation for usage and examples.
# Functions
Add1 returns the value of a + 1.
ByteCount formats b as in a compact, human-readable unit of measure.
ByteCountFloat formats b as in a human-readable unit of measure.
Capitalize returns a string with the first letter of the first word capitalized.
CfUUID formats a 35 character, Coldfusion Universally Unique Identifier to a standard, 36 character, Universally Unique Identifier.
ChrLast returns the last character or rune of the string.
CookieStore generates a key for use with the sessions cookie store middleware.
Count returns the number of files in the given directory.
CountExts returns the file extensions and the number of files in the given directory.
Day returns true if the i value can be used as a day time value.
DeleteDupe removes duplicate strings from a slice.
Deobfuscate the obfuscated string, or return the original string.
DeobfuscateID an obfuscated ID to return the primary key of the record.
Deobfuscate an obfuscated record URL to return a record's primary key.
Determine returns the encoding of the plain text byte slice.
DiskUsage returns the total size of the files in the given directory.
Duplicate is a workaround for renaming files across different devices.
DuplicateOW is a workaround for renaming files across different devices.
File returns true if the named file exists on the system.
FileMatch returns true if the two named files are the same.
Files returns the filenames in the given directory.
Finds returns true if the name is found in the collection of names.
FmtSlice formats a comma separated string.
Integrity returns the sha384 hash of the named embed file.
IntegrityBytes returns the sha384 hash of the given byte slice.
IntegrityFile returns the sha384 hash of the named file.
Latency returns the stored, current local time.
Lines returns the number of lines in the named file.
LocalHostPing sends a HTTP GET request to the provided URI on the localhost and returns the status code and size of the response.
LocalHosts returns a list of local hostnames.
LocalIPs returns a list of local IP addresses.
Logger returns the logger from the context.
MaxLineLength counts the character length of the longest line in a string.
MkContent returns the destination directory for the extracted archive content.
Obfuscate a numeric string to insecurely hide database primary key values when passed along a URL.
ObfuscateID the primary key of a record as a string that is used as a URL param or path.
Owner returns the running user and group of the web application.
PageCount returns the maximum pages possible for the sum of records with a record limit per-page.
Ping sends a HTTP GET request to the provided URI and returns the status code and size of the response.
Released returns a string release date as year, month, day int16 values.
RenameCrossDevice is a workaround for renaming files across different devices.
RenameFile renames a file from oldpath to newpath.
RenameFileOW renames a file from oldpath to newpath.
ReverseInt reverses an integer.
SearchTerm returns a list of search terms from the input string.
ShortMonth takes a month integer and abbreviates it to a three letter English month.
Size returns the size of the named file.
Slug returns a URL friendly string of the named group.
SplitAsSpaces splits a string at each capital letter.
Stat stats the named file or directory to confirm it exists on the system.
StrongIntegrity returns the SHA-386 checksum value of the named file.
Sum386 returns the SHA-386 checksum value of the open file.
TimeDistance describes the difference between two time values.
Titleize returns a string with the first letter each word capitalized.
TempDir returns the temporary directory for the server, which is a subdirectory of the system temp directory.
Touch creates a new, empty named file.
TouchW creates a new named file with the given data.
TrimPunct removes any trailing, common punctuation characters from the string.
TrimRoundBraket removes the tailing round brakets and any whitespace.
TruncFilename reduces a filename to the length of w characters.
UTF8 returns true if the named file is a valid UTF-8 encoded file.
Year returns true if the i value is greater than 1969 or equal to the current year.
Years returns a string of the years if they are different.
# Constants
Directory permissions.
DSStore is the macOS directory service store file.
Eraseline is an ANSI escape control to erase the active line of the terminal.
LoggerKey is the key used to store the logger in the context.
TempBase is the base subdirectory for temporary files.
Timeout is the HTTP client timeout.
User-Agent to send with the HTTP request.
WriteWriteRead is the file mode for read and write access.
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author