rename
Renames a file or directory within its parent directory.
Example
ts
import { SF } from "@duplojs/server-utils";
const result = await SF.rename("/tmp/file.txt", "renamed.txt");
// result: E.Ok | SF.FileSystemLeft
await SF.rename("/tmp/notes.txt", "notes-old.txt");Syntax
typescript
function rename(
path: string | URL,
newName: string
): Promise<FileSystemLeft | E.Ok>Parameters
path: path to rename.newName: new name (without path).
Return value
E.Ok: if renaming succeeds.FileSystemLeft: if renaming fails.
See also
move- Moves a file or directory.
