makeDirectory
Creates a directory.
Example
ts
import { SF } from "@duplojs/server-utils";
import { E } from "@duplojs/utils";
const result = await SF.makeDirectory("/tmp/project");
// result: E.Ok | SF.FileSystemLeft
if (E.isRight(result)) {
// directory create with success
}
await SF.makeDirectory("/tmp/project/sub", { recursive: true });Syntax
typescript
function makeDirectory(
path: string | URL,
params?: {
recursive?: boolean
}
): Promise<FileSystemLeft | E.Ok>Parameters
path: path of the directory to create.params.recursive: also creates parent directories iftrue.
Return value
E.Ok: if creation succeeds.FileSystemLeft: if creation fails.
See also
ensureDirectory- Ensures a directory exists.
