spade-0.1.0.9: docs/functions/file.md
### File Functions
#### readfile
Reads the file at path provided as argument, and returns its contents
as bytes.
#### readtextfile
Reads the file at path provided as argument, and returns its contents
as a string.
#### writefile
Accept a file path as the first argument, and content as a second argument
and writes content to the file at path. Any existing content is truncated.
Content can be either bytes or text.
#### opendir
Accept a path to a directory and opens it and returns an iterator that
can be used with foreach. Accepts a second boolean argument, if true
the directory will be walked recursively. Does not follow symbolic links.
Each item in the iteration is a dictionary that will contain the following keys.
path: Will contain the full path to the file
type: Will conain either the string "file", if the item is a file, "dir" if the
item is a directory, "symlink" is the item is a symbolic link, or "error" if
there was an error reading the items file entry.
#### getcurrentdir
Gets the current directory as a string.
#### takefilename
Gets the filename component of a path.
#### takedirectory
Gets the directory component of a path.
#### takeextension
Gets the extension component of a path.
#### dropextension
Gets the path with extension removed.
#### takebasename
Gets the name without extension and directory.
#### joinpaths
Accepts two path components and join them.
#### readfilehandle
Reads the specified number of bytes from the provided file handle. If there is not enough data remaining to read, returns all the remaining data. So it returns a bytes value of zero length on end of file, and can be used to detect EOF.
#### writefilehandle
Accepts a file handle and a bytes value and writes it to the handle.
#### openfilehandle
Opens a file handle in one of the given modes "r", "w", "rw", "a".
#### gethandlesize
Returns the size of the associated file of the handle in 8 bit bytes.
#### renamefile
Renames a file to new name.
#### isfile
Checks if a path is a file.
#### isdirectory
Checks if a path is a directory.