npm

npm‚Äôs 2019 JavaScript ecosystem survey analysis is now available!Get your copy here ¬Ľ

@alexbinary/cp

1.0.1¬†‚Äʬ†Public¬†‚Äʬ†Published

cp

Simple file/directory copy with promise support ūüéČ

npm GitHub release Build Status dependencies Status devDependencies Status

Based on ncp by mmalecki

Uses @alexbinary/promisify and @alexbinary/callbackify by alexbinary

Install

Install with npm or yarn :

$ npm install @alexbinary/cp
# or 
$ yarn add @alexbinary/cp

Usage

let cp = require('@alexbinary/cp')
 
// copy a file
cp('/source/foo.txt', '/target/foo.txt').then(() => {
  // file /source/foo.txt is copied under /target/foo.txt
  // folder /target is created if it does not exist
})
 
// copy a folder
cp('/source/folder', '/target/folder').then(() => {
  // folder /source/folder is copied with all its content under /target/folder
  // folder /target is created if it does not exist
})

Documentation

let cp = require('@alexbinary/cp')

cp(source, target)

Copies file or directory from source to target.

If source is a directory then it is copied with all its content.

Intermediate directories are created if necessary.

This method supports both Promise and node callback style, and resolves with no arguments.

cp.sync(source, target)

Synchronous version.

Licence

MIT

install

npm i @alexbinary/cp

Downloadsweekly downloads

6

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability