move

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

function

async function move(src: string | URL, dest: string | URL, options?: MoveOptions): Promise<void>

Asynchronously 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 promise that resolves once the operation completes.

Example: Basic usage

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

await move("./foo", "./bar");

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

Example: Overwriting

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

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

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

See also

Source