copyFile

import { copyFile } from "jsr:@ende/fs/unstable-copy-file";

function · experimental · requires --allow-read, --allow-write

async function copyFile(from: string | URL, to: string | URL): Promise<void>

Copies the contents and permissions of one file to another specified path, by default creating a new file if needed, else overwriting. Fails if target path is a directory or is unwritable.

Requires allow-read and allow-write permission.

For a full description, see copyFile.

from: string | URL

The path of source filename to copy.

to: string | URL

The path of destination filename.

Example: Usage

import { copyFile } from "@ende/fs/unstable-copy-file";
copyFile("README.md", "README-Copy.md");

Source