relocate
Relocates a path into a new parent directory.
Example
ts
import { SF } from "@duplojs/server-utils";
import { E, unwrap } from "@duplojs/utils";
const result = await SF.relocate("/tmp/example.txt", "/tmp/archive");
// result: E.Success<string> | SF.FileSystemLeft<"relocate">
if (E.isRight(result)) {
const newPath = unwrap(result);
// newPath: string
}Syntax
typescript
function relocate(
fromPath: string,
newParentPath: string
): Promise<FileSystemLeft<"relocate"> | E.Success<string>>Parameters
fromPath: path to relocate.newParentPath: destination parent directory.
Return value
E.Success<string>: the new path when relocation succeeds.FileSystemLeft<"relocate">: if relocation fails.
