[10:21] static
(extern: com.lehman.aussom.stdlib.AussomFile) extends: object
Aussom file is a static class with a bunch of functions for manipulating files. It has some basic read/write files, along with list, rm, rename, delete, and many others.
write (string name, string data, bool append = false
)
Writes a text file with to the provided file name with the provided data.
name
is a string with the file name to write.data
is a string with the text data to write.append
is an optional flag with true to append and false to not.A
boolean with true if successful.read (string name
)
Reads a text file with the provided file name.
name
is a string with the file name to read.A
string with the contents of the file.writeBinary (string name, object data
)
Writes a binary file with the provided file name and buffer object.
name
is a string with the file name to write.data
is a buffer object with the data to write.A
boolean with true if successful.readBinary (string name
)
Reads a binary file with the provided file name.
name
is a string with the file name to read.A
buffer object with the data from the file._readBinary (string name, object buff
)
Wrapped function for passing in a new buffer object to read into.
name
is a string with the file name to read.buff
is a buffer object to read data into.A
buffer object with the results.ls (string dir
)
Produces a list of files and directories in the provided directory name string. This function returns a list of map objects with many details for each file or directory.
dir
is a string with the directory to list.A
list of map objects with the directory contents.rm (string name
)
Removes the file or directory with the name provided.
name
is a string with the file or directory to remove.A
boolean with true for success.rmr (string name
)
Removes the file or directory with the name provided recursively.
name
is a string with the file or directory to remove.A
boolean with true for success.exists (string name
)
Checks to see if the provided file or directory exists.
name
is a string with the file or directory to check.A
boolean with true for exists and false for not.isFile (string name
)
Checks to see if the provided name is a file.
name
is a string to check if it's a file.A
boolean with true if it's a file.isDir (string name
)
Checks to see if a provided name is a directory.
name
is a string to check if it's a directory.A
boolean with true if it's a directory.canExecute (string name
)
Checks to see if the provided name can be executed.
name
is a string to check if it can be executed.A
boolean with true if it can be executed.canRead (string name
)
Checks to see if the provided name can be read.
name
is a string to check if it can be read.A
boolean with true if it can be read.canWrite (string name
)
Checks to see if the provided name can be written.
name
is a string to check if it can be written to.A
boolean with true if it can be written to.getAbsPath (string name
)
Gets the absolute path with the provided file name.
name
is a string with a file name.A
string with the absolute path.getCanonicalPath (string name
)
Gets the canonical path with the provided file name.
name
is a string with a file name.A
string with canonical path.getName (string name
)
Gets the name of the file or path with the provide file or path name.
name
is a string with a file or path name.A
string with the file or path name.getParent (string name
)
Gets the parent directory of the provided file or directory.
name
is a string with a file or directory.A
string with the parent directory.isAbsolute (string name
)
Checks if the provided path name is absolute.
name
is a string with the path to check.A
boolean with true if it's absolute.isHidden (string name
)
Checks to see if the provided path is hidden.
name
is a string with the path to check.A
boolean with true if the path is hidden.lastModified (string name
)
Gets the last modified date for the provided path.
name
is a string with the path.An
int with the seconds since epoch of the last modified date.length (string name
)
Gets the length of the path in bytes.
name
is a string of the file name.An
int with the number of bytes.mkdir (string name
)
Makes a directory with the provided name.
name
is a string with the directory name to create.A
boolean with true.mkdirs (string name
)
Makes nested directories with the provided path.
name
is a string with the path of directories to create.A
boolean with true.rename (string name, string newName
)
Attempts to rename the provided file to a new file name.
name
is a string with the source file name.newName
is a string with the destination file name.A
boolean with true.setExecutable (string name
)
Sets the provided file executable.
name
is a string with the file name to set.A
boolean with true.setReadable (string name
)
Sets the provided file as readable.
name
is a string with the file name to set.A
boolean with true.setWritable (string name
)
Sets the provided file to writable.
name
is a string with the file name to set.A
boolean with true.cp (string src, string dst, bool replace = true
)
Copies the source file to the destination file.
src
is a string with the source file.dst
is a string with the destination file.replace
is a boolean with true to replace if it exists and false if not. (default true)A
boolean with true.cpr (string src, string dst, bool replace = true
)
Copies the source file to the destination file. The cpr function is similar to cp but it coppies recursively.
src
is a string with the source file.dst
is a string with the destination file.replace
is a boolean with true to replace if it exists and false if not. (default true)A
boolean with true.