moveSync

import { moveSync } from "jsr:@ende/fs";

function

function moveSync(src: string | URL, dest: string | URL, options?: MoveOptions): void

Synchronously moves a file or directory (along with its contents).

Requires --allow-read and --allow-write permissions.

src: string | URL

The source file or directory as a string or URL.

dest: string | URL

The destination file or directory as a string or URL.

options?: MoveOptions

Options for the move operation.

Returns

A void value that returns once the operation completes.

Example: Basic usage

import { moveSync } from "@ende/fs/move";

moveSync("./foo", "./bar");

This will move the file or directory at ./foo to ./bar without overwriting.

Example: Overwriting

import { moveSync } from "@ende/fs/move";

moveSync("./foo", "./bar", { overwrite: true });

This will move the file or directory at ./foo to ./bar, overwriting ./bar if it already exists.

See also

Source