copyFileSync

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

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

function copyFileSync(from: string | URL, to: string | URL): void

Synchronously 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 copyFileSync.

from: string | URL

The path of source filename to copy.

to: string | URL

The path of destination filename.

Example: Usage

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

Source