Module std/fs/dir.vv
The fs/dir module provides low-level directory operations.
Example:
import dir from "std/fs/dir.vv"
import list from "std/list.vv"
import console from "std/console.vv"
if dir.exists("test")
let files = try dir.read("test")
list.each(files, fun(i, file)
console.print(file)
end)
end
Exports
fun read(path)
extern "native"
Reads the contents of a directory.
path: The path to the directory.
Returns a list of filenames (strings) in the directory on success, or an error.
fun create(path)
extern "native"
Creates a new directory.
path: The path to the directory to create.
Returns ok(none) on success, or an error on failure.
fun remove(path)
extern "native"
Removes a directory (and all its contents).
path: The path to the directory to remove.
Returns ok(none) on success, or an error on failure.
fun exists(path)
extern "native"
Checks if a directory exists.
path: The path to check.
Returns true if it exists and is a directory.