ncp

Asynchronous, recursive file and directory copying for Node.js, usable as a CLI tool or a simple callback-based API.

Library
npm
v2.0.0
679 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
34 /100 Needs Attention
Development Activity 0
Maintenance 0
Community 56
Maturity 60
Momentum 20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
44 /100 Fair
Architecture 55
Code Quality 45
Innovation 50
Learning Curve 25

ncp (“Node cp”) recursively copies files and directories using Node’s core fs and path modules, running copy operations asynchronously and concurrently up to a configurable limit rather than sequentially like a naive cp -r port. It preserves file modes and can optionally dereference symlinks, skip already-up-to-date files by modification time, and pipe file contents through a custom transform stream while copying.

The package ships both a CLI binary (ncp source dest --filter= --limit= --stoponerr) and a programmatic API (require('ncp').ncp(source, dest, options, callback)), making it usable directly from the command line or embedded in build scripts and other Node tooling. It was a widely-used dependency in the pre-fs.promises/fs-extra era for cross-platform recursive copying.

What You Get

  • A CLI binary (ncp) for recursive copies straight from the terminal, with --filter, --limit, and --stoponerr flags
  • A programmatic ncp(source, dest, options, callback) API for embedding recursive copy logic in scripts and build tools
  • Configurable copy filtering via a RegExp or a custom predicate function applied to each file path
  • A transform hook that lets callers pipe file contents through a custom stream (e.g. for on-the-fly text substitution) instead of a raw byte-for-byte copy
  • Symlink handling with an optional dereference mode, plus clobber and modified-time-aware (modified) overwrite controls

Common Use Cases

  • Copying a template or fixture directory tree as part of a build or scaffolding script
  • Recursively copying build output or static assets between directories in an npm scripts pipeline
  • Selectively copying files that match a pattern (e.g. excluding test fixtures or dotfiles) via the filter option
  • Copying only files that have changed since the destination was last updated, using the modified option to skip untouched files

Under The Hood

Architecture The entire copy engine lives in a single file, lib/ncp.js, as one exported ncp(source, dest, options, callback) function built from nested closures rather than separate modules or classes. A startCopy/getStats pair walks the tree node by node using fs.lstat/fs.stat, branching into onFile, onDir, or onLink handlers that each recurse back into startCopy for children; a shared started/finished/running counter trio (checked in the cb() callback) is the sole synchronization mechanism that detects when the whole recursive walk has completed. This flat, single-function design keeps the whole traversal easy to hold in your head for a small utility, but every code path (filtering, symlink dereferencing, clobber/modified checks, error aggregation) is threaded through the same closure, so extending behavior means touching the one function rather than composing independent pieces.

Tech Stack ncp has zero runtime dependencies, relying only on Node’s built-in fs and path modules, and its CLI wrapper (bin/ncp) does manual process.argv parsing rather than pulling in an args-parsing library. Its devDependencies — mocha, rimraf, read-dir-files, all pinned to old minor-version ranges — are test-only. The package.json targets node >=0.10, and the checked-in .travis.yml builds against Node 0.10, 0.12, and io.js, reflecting the package’s 2011-2015 origin and lack of any updates since for modern Node/ESM tooling.

Code Quality A real test suite exists at test/ncp.js (197 lines) exercising regular-file copying, regex-based filtering, and symlink/broken-symlink fixtures via Mocha and assert, giving the core copy behavior meaningful coverage. Error handling is callback-style: failures are accumulated into an array or written to an options.errs stream rather than thrown, so callers must remember to check the callback’s error argument, and there is no TypeScript, no linter/formatter configuration, and no modern CI (the Travis config is present but stale and would not run against current Node versions).

API Design The public surface is a single low-ceremony call — ncp(source, dest, [options], callback) — with sensible defaults (clobber on, dereference/modified off) and orthogonal options (filter, transform, limit) that compose without extra setup, plus a CLI (ncp src dest --filter= --limit= --stoponerr) that mirrors the same flags. The tradeoff is an entirely callback-based contract with no native Promise or async/await support, and documentation limited to the README’s option list with no generated API reference or TypeScript types, which raises friction for anyone integrating it into a modern async codebase.

Used by 8 apps in this directory

TypeScript
92%
GPL 3.0

Blinko

Knowledge Management · Note Taking

11,049

A self-hosted, AI-powered card note-taking tool that lets you capture fleeting thoughts instantly and retrieve them with natural language search.

View details
75
Repo Health
69
Technical
63
Dependency
Built with
TypeScript 92%
Updated 1 months ago
TypeScript
84%
Apache 2.0

Continue

AI Code Assistants · AI Development · Automation

36,049

Open-source coding agent for VS Code, JetBrains, and CLI with support for 30+ LLM providers.

View details
73
Repo Health
88
Technical
62
Dependency
Built with
TypeScript 84%
Updated 5 days ago
TypeScript
95%
MIT

melty

AI Code Assistants · Code Editors · Developer Tools

5,444

The AI code editor where every chat message is a git commit you can revert, branch, or squash

View details
35
Repo Health
75
Technical
67
Dependency
Built with
TypeScript 95%
Updated 1 years ago
TypeScript
98%
Other

Novu

Developer Tools

40,084

Open-source communication infrastructure that connects your products and AI agents to every channel your users live on — Inbox, Email, SMS, Push, Chat, and more.

View details
93
Repo Health
80
Technical
64
Dependency
Built with
TypeScript 98%
Updated 5 days ago
TypeScript
96%
Other

Refly

AI Development · Automation · No Code Platforms

7,534

Build deterministic, versioned agent skills from natural language—run them anywhere from Claude Code to Slack.

View details
62
Repo Health
76
Technical
63
Dependency
Built with
TypeScript 96%
Updated 2 months ago
TypeScript
97%
AGPL 3.0

Responsively App

Design Tools · Developer Tools

25,201

Preview and interact with your responsive web design across every device size simultaneously — no more manual resizing.

View details
78
Repo Health
71
Technical
67
Dependency
Built with
TypeScript 97%
Updated 1 weeks ago
TypeScript
95%
Apache 2.0

Void

AI Code Assistants · Automation · Code Editors

28,786

Open-source AI code editor with direct LLM integration and data privacy

View details
45
Repo Health
84
Technical
68
Dependency
Built with
TypeScript 95%
Updated 4 months ago
TypeScript
65%
AGPL 3.0

Worklenz

Collaboration · Product Management · Project Management

3,191

All-in-one open source project management for teams who want full control — plan projects, track tasks, manage resources, and monitor finances without the SaaS lock-in.

View details
86
Repo Health
7
Technical
64
Dependency
Built with
TypeScript 65%
JavaScript 23%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers