remove
Removes a file or directory.
Example
ts
import { SF } from "@duplojs/server-utils";
import { E } from "@duplojs/utils";
const result = await SF.remove("/tmp/file.txt");
// result: E.Ok | SF.FileSystemLeft
if (E.isRight(result)) {
// element remove with success
}
await SF.remove("/tmp/project", { recursive: true });Syntax
typescript
function remove(
path: string | URL,
params?: {
recursive?: boolean
}
): Promise<FileSystemLeft | E.Ok>Parameters
path: path to remove.params.recursive: removes a non-empty directory iftrue.
Return value
E.Ok: if removal succeeds.FileSystemLeft: if removal fails.
See also
copy- Copies a file or directory.
