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

recursive-copy

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recursive-copy

Simple, flexible file copy utility

  • 2.0.14
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is recursive-copy?

The recursive-copy npm package is a utility for copying files and directories recursively with support for filtering, transforming, and other advanced options.

What are recursive-copy's main functionalities?

Basic Copy

This feature allows you to copy files and directories from a source to a destination. The code sample demonstrates a basic copy operation where files from the 'source' directory are copied to the 'destination' directory.

const copy = require('recursive-copy');

copy('source', 'destination')
  .then(function(results) {
    console.info('Copied ' + results.length + ' files');
  })
  .catch(function(error) {
    console.error('Copy failed: ' + error);
  });

Filtering Files

This feature allows you to filter which files to copy using glob patterns. The code sample demonstrates copying only JavaScript files except for test files.

const copy = require('recursive-copy');

copy('source', 'destination', {
  filter: ['**/*.js', '!**/*.test.js']
})
  .then(function(results) {
    console.info('Copied ' + results.length + ' files');
  })
  .catch(function(error) {
    console.error('Copy failed: ' + error);
  });

Transforming Files

This feature allows you to transform files during the copy process. The code sample demonstrates transforming text files to uppercase while copying.

const copy = require('recursive-copy');
const fs = require('fs');

copy('source', 'destination', {
  transform: function(src, dest, stats) {
    if (src.endsWith('.txt')) {
      return through(function(chunk, enc, done) {
        this.push(chunk.toString().toUpperCase());
        done();
      });
    }
  }
})
  .then(function(results) {
    console.info('Copied ' + results.length + ' files');
  })
  .catch(function(error) {
    console.error('Copy failed: ' + error);
  });

Other packages similar to recursive-copy

Keywords

FAQs

Package last updated on 13 Feb 2022

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