Modern recursive copy utilities for JavaScript and TypeScript.
copy-tree-modern is a migration path for callback-era packages such as ncp. It uses Node's native recursive copy implementation, keeps the useful callback shape for old code, and exposes a promise-first API for new code.
npm install copy-tree-modernimport { copyTree } from "copy-tree-modern";
await copyTree("fixtures/site", "dist/site", {
overwrite: true,
filter: (source) => !source.endsWith(".map")
});import { ncp } from "copy-tree-modern";
ncp("fixtures/site", "dist/site", { clobber: false }, (error) => {
if (error) throw error;
});Copies a file or directory tree. Parent directories for destination are created automatically.
Options:
overwrite: replace existing files. Defaults totrue.errorOnExist: throw if the destination exists and overwrite is disabled.dereference: follow symlinks.preserveTimestamps: preserve copied file timestamps.verbatimSymlinks: preserve symlink text exactly where the platform supports it.filter: sync or async predicate called with(source, destination).
Callback-compatible adapter for code migrating away from ncp.
This package targets Node 18 and newer. It intentionally does not reimplement stream transforms or old concurrency internals because Node's native fs.cp handles the copy traversal directly.
copy-tree-modern is an independent alternative or migration helper for projects moving away from ncp. It is not affiliated with the original package maintainers or project.
For release context, see the local migration guide, examples, compatibility notes, source metadata, and adoption plan.