arango.fs
File system utilities for Foxx applications
base-name
(base-name path)
(base-name path trim-ext)
Returns the base name (final segment/file part) of a path.
If optional trim-ext
is a string and the path ends with that string, it is trimmed.
If trim-ext
is true, any extension is trimmed.
delete
(delete path)
Deletes a file or an empty directory.
delete-dir
(delete-dir directory)
Deletes a diretory recursively.
delete-file
(delete-file path)
delimiter
The platform-specific path delimiter, ‘;’ on Windows or ‘:’ on *nix.
directory?
(directory? path)
exist?
(exist? path)
Returns true if path exists.
extension
(extension path)
Returns the extension part of a file.
home
(home)
Returns current user’s home directory
join
(join & paths)
Join all arguments together and normalize the resulting path.
Arguments must be strings.
list-dir
(list-dir path)
Lists files and directories under path.
list-tree
(list-tree path)
Lists all files and directories under path.
move
(move source dest)
Moves a file from source
to dest
.
normalize
(normalize path)
Normalizes a string path, taking care of ‘..’ and ‘.’ parts.
When multiple slashes are found, they’re replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.
parents
(parents path)
Gets all the parent directories of a path.
separator
The platform-specific file separator, ‘' on Windows or ’/’ on *nix.
size
(size path)
Returns size (in bytes) of file.
slurp
(slurp filename)
Opens a file and reads all its contents, returning a string.
slurp64
(slurp64 filename)
Like slurp but returns contents as a base64-encoded string.
spit
(spit filename content)
Opens a file, writes content, then closes it.
temp-file
(temp-file)
(temp-file dir)
Creates a temporary file.
temp-name
(temp-name)
(temp-name dir)
Generates a temporary file name. Does not create file.
tmpdir
(tmpdir)
The temporary file directory.
unzip
(unzip filename out-path skip-paths overwrite?)
(unzip filename out-path skip-paths overwrite? password)
Extracts compressed files in a ZIP archive
zip
(zip filename chdir files)
(zip filename chdir files password)
Compresses files as a ZIP archive