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

copy

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

copy

Copy files or directories using globs.

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
decreased by-15.51%
Maintainers
2
Weekly downloads
 
Created
Source

copy NPM version

Copy files or directories using globs.

TODO

  • sync
  • async
  • dir
  • dir sync
  • one file
  • one file sync
  • promise
  • stream
  • docs
  • tests

Install

Install with npm

$ npm i copy --save

Usage

var copy = require('copy');

Examples

Usage with [gulp]

In your project's gulpfile.js:

var gulp = require('gulp');
var copy = require('copy');

gulp.task('default', function (cb) {
  copy('fixtures/*.txt', 'actual', cb);
});

API

copy

Asynchronously copy a glob of files from a to b.

Params

  • patterns {String|Array}: Glob pattern or array of glob patterns.
  • dest {String}: Destination directory
  • options {Object}: Options for [mkdirp] or [globby]. You may also pass a custom [rewrite] function on the options.
  • cb {Function}: Callback
  • err {Object}: [cb] Error object
  • files {Array}: [cb] Array of files

.sync

Synchronously copy a glob of files from a to b.

Params

  • patterns {String|Array}: Glob pattern or array of glob patterns.
  • dest {String}: Destination directory
  • options {Object}: Options for [mkdirp] or [globby]. You may also pass a custom [rewrite] function on the options.

.dir

Asynchronously and recursively copy all files in directory a to b.

Params

  • dirname {String}: Source directory
  • dest {String}: Destination directory
  • options {Object}: Options for [mkdirp]. You may also pass a custom [rewrite] function on the options.
  • cb {Function}: Callback
  • err {Object}: [cb] Error object
  • files {Array}: [cb] Array of files

.dirSync

Synchronously and recursively copy all files in directory a to b.

Params

  • dirname {String}: Source directory
  • dest {String}: Destination directory
  • options {Object}: Options for [mkdirp]. You may also pass a custom [rewrite] function on the options.

.one

Asynchronously copy a single file from a to b. A thin wrapper around the copy.base method, to provide error reporting and to create directories when they don't already exist.

Params

  • fp {String}: Source file path
  • dest {String}: Destination directory
  • options {Object}: Options for [mkdirp]. You may also pass a custom [rewrite] function on the options.
  • cb {Function}: Callback
  • err {Object}: [cb] Error object
  • files {Array}: [cb] Array of files

.oneSync

Synchronously copy a single file from a to b. A thin wrapper around the copy.base method, to provide error reporting and to create directories when they don't already exist.

Params

  • fp {String}: Source file path
  • dest {String}: Destination directory
  • options {Object}: Options for [mkdirp]. You may also pass a custom [rewrite] function on the options.

.base

Base function for copying files.

Params

  • src {String}: Source file path
  • dest {String}: Destination directory
  • returns {String}

{%= related(['write', 'read-data', 'read-yaml', 'export-files']) %}

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on July 03, 2015.

Keywords

FAQs

Package last updated on 16 Jul 2015

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