keen/io/file

Source
path-already-exists record
path string
show string(a path-already-exists)
path-not-found record
path string
show string(a path-not-found)
file-system-error record
path string
description string
show string(a file-system-error)
path-exists bool(path string) global
true if anything (like a file or directory) exists at the path.
is-directory bool(path string) global
true if path is the path of a directory, or a symlink to a directory. false if there is anything else at the path, or nothing at the path.
is-file bool(path string) global
true if path is the path of a file, or a symlink to a file. false if there is anything else at the path, or nothing at the path.
path-kind enum
file
directory
other
== bool(a path-kind, b path-kind)
to symbol(a path-kind)
show string(a path-kind)
get-path-kind path-kind(path string) global
paths-in-dir string[](path string) global
Returns all children of the directory path, as full paths. Use names-in-dir instead if you want just the basenames.
names-in-dir string[](a string) global
Returns the basename of all children of the directory. Does not include ".." or ".". Use paths-in-dir instead if you want full paths.
read-link string(_ string) global
Gets the path a symbolic link refers to.
make-symlink-to void(link string, target string) global
Create a symbolic link at link with the target target.
current-executable-path string() global
Gets the path of the current executable. If this program was built to executable, this will return its path. Otherwise, this will be the path where keen is installed.
read-file string(path string) global
Reads the full contents of the file.
copy-file void(from string, to string) global
write-file void(path string, content string) global
Writes the full contents of the file as a string. If the file already exists, overwrites it.
write-file void(path string, content nat8[]) global
read-file nat8[](path string) global
current-directory string() global
Gets the current directory (of the user that ran the program).
each-child-recursive void(path string, f void mut(string)) global
If path is a directory, calls f on each file in the directory and any nested directories. If path is a file, calls f once.
each-child-recursive void(path string, filter bool mut(string), f void mut(string)) global
Like each-child-recursive, but calls filter on names of directory children and skips them if filter returns false.
file-permissions record
POSIX file permissions.
permissions record
read bool
write bool
execute bool
Permissions for one of user, group, public.
all permissions()
read-only permissions()
to nat64(a file-permissions)
to nat64(a permissions)
no-permissions permissions()
all-permissions permissions()
read-write permissions()
user-only file-permissions(user-permissions permissions)
set-permissions void(path string, permissions file-permissions) global
make-directory void(path string) global
Creates a new empty directory at path.
ensure-directory void(path string) global
Like 'make-directory', but OK if it already exists.
remove-file void(path string) global
Deletes the file at path.
remove-directory void(path string) global
Deletes the directory at path. It should be empty.
temp-file record
prefix string
suffix string
with-block[t] t(a temp-file, f t mut(string)) global