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

cpy

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cpy

Copy files

  • 11.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.5M
increased by2.75%
Maintainers
1
Weekly downloads
 
Created

What is cpy?

The cpy npm package is a simple file copying utility for Node.js. It allows you to copy files or directories from one location to another with various options such as overwriting existing files, preserving directory structure, and more.

What are cpy's main functionalities?

Copy files

This feature allows you to copy files matching a specific pattern (e.g., all PNG files in the 'source' directory) to a destination directory.

const cpy = require('cpy');

cpy(['source/*.png'], 'destination').then(() => {
  console.log('Files copied!');
});

Copy files with options

This feature allows you to copy files with additional options such as not overwriting existing files (`overwrite: false`) and preserving the directory structure (`parents: true`).

const cpy = require('cpy');

cpy(['source/*.png'], 'destination', {
  overwrite: false,
  parents: true
}).then(() => {
  console.log('Files copied with options!');
});

Copy and rename

This feature allows you to copy a file and rename it in the destination directory using a rename function.

const cpy = require('cpy');

cpy(['source/file.txt'], 'destination', {
  rename: basename => `new-${basename}`
}).then(() => {
  console.log('File copied and renamed!');
});

Other packages similar to cpy

Keywords

FAQs

Package last updated on 26 Jul 2024

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