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

clean-copy

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clean-copy

Recursively copy while ignoring certain directories (e.g. node_modules)

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

clean-copy

Recursively copy while ignoring certain directories (e.g. node_modules)

Installing

npm

$ npm i -S clean-copy

yarn

$ yarn add clean-copy

Usage

/* filesystem
/root/
|----/a/
     |-/asd.txt
     |-/xyz/
     | |---/fgh.txt
     |-/node_modules/
       |------------/etc/
*/

import copy from 'clean-copy'

copy('root/a', 'root/b', path => !/^node_modules$/.test(path))

/* filesystem
/root/
|----/a/
|    |-/asd.txt
|    |-/xyz/
|    | |---/fgh.txt
|    |-/node_modules/
|      |------------/etc/
|----/b/
     |-/asd.txt
     |-/xyz/
       |---/fgh.txt
*/

API

copy : (from : String, to : String, [filter : Regex | String -> Boolean = () => true]) -> Promise Error Any Recursively copies files and directories from from to to, where only candidate paths for which filter returns true are copied. If filter is a Regex, filter.test will be used as the predicate. If the operation is successful, the Promise will resolve.

copy checks to see if to is or will be a child of from, and will throw an error if so. This prevents a directory from recursively specifying itself as a candidate path.

Keywords

FAQs

Package last updated on 15 Oct 2016

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