Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ncp

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ncp

Asynchronous recursive file copy utility.

  • 0.5.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is ncp?

The ncp (node-copy-paste) npm package is a Node.js module that provides asynchronous recursive file copying with Node.js. It is often used for tasks such as copying entire directories, handling errors, and limiting the number of concurrent file transfers.

What are ncp's main functionalities?

Asynchronous Recursive File & Directory Copying

This feature allows you to copy files and directories from a source to a destination asynchronously. You can also set a limit on the number of concurrent copy actions.

const ncp = require('ncp').ncp;

ncp.limit = 16;

ncp(source, destination, function (err) {
 if (err) {
   return console.error(err);
 }
 console.log('Copy operation complete!');
});

Error Handling

ncp provides a callback function that can be used to handle errors that occur during the copy process.

const ncp = require('ncp').ncp;

ncp(source, destination, function (err) {
 if (err) {
   console.error('Error during copy:', err);
 }
});

Filtering Files

ncp allows you to specify a filter for the copy operation, so only files that match the given regular expression will be copied.

const ncp = require('ncp').ncp;

ncp(source, destination, {
 filter: /\.(txt|html)$/i
}, function (err) {
 if (err) {
   return console.error(err);
 }
 console.log('Copy operation complete!');
});

Other packages similar to ncp

Keywords

FAQs

Package last updated on 18 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc