Module fs/dir
fs/dir
Async directory operations — create, remove, read, link, rename.
Wraps low-level std/sys/dir with typed APIs using the Exception effect.
Example
{ create_dir, remove_dir, read_dir } :: import "std/fs/dir";
{ Path } :: import "std/path";
main :: (fn(using(io : IO)) -> unit)({
given(exn) : Exception = {
throw : (fn(forall(T : Type), error: AnyError) -> T)(
{ println(error.to_string()); exit(i32(1)); }
)
};
io.await(create_dir(Path.new(`/tmp/yo_test`)));
entries := io.await(read_dir(Path.new(`/tmp/yo_test`)));
io.await(remove_dir(Path.new(`/tmp/yo_test`)));
});
Types
FileType
enum
FileType
The type of a file system entry.
Variants
| Variant | Fields | Description |
|---|---|---|
File | A regular file. | |
Directory | A directory. | |
Symlink | A symbolic link. | |
Other | An unknown or unsupported file type. |
Functions
create_dir
function
create_dir_str
function
create_dir_all
function
create_dir_all_str
function
remove_dir
function
remove_dir_str
function
remove_file
function
remove_file_str
function
rename
function
rename_str
function
hard_link
function
hard_link_str
function
symlink
function
symlink_str
function