All Projects β†’ jonschlinkert β†’ copy

jonschlinkert / copy

Licence: MIT license
Copy files using glob patterns. Sync, async, promise or streams. (node.js utility)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to copy

fs-utils
Generalized file and path utils for Node.js projects.
Stars: ✭ 33 (-60.71%)
Mutual labels:  copy, fs, write
Fcfilemanager
iOS File Manager on top of NSFileManager for simplifying files management. πŸ“‚
Stars: ✭ 862 (+926.19%)
Mutual labels:  files, copy
Chonky
😸 A File Browser component for React.
Stars: ✭ 313 (+272.62%)
Mutual labels:  files, fs
Write Files Atomic
Write many files atomically
Stars: ✭ 126 (+50%)
Mutual labels:  files, fs
Temperment
Get a random temporary file or directory path that will delete itself
Stars: ✭ 21 (-75%)
Mutual labels:  files, fs
Copy
Go copy directory recursively
Stars: ✭ 264 (+214.29%)
Mutual labels:  files, copy
Go Storage
An application-oriented unified storage layer for Golang.
Stars: ✭ 87 (+3.57%)
Mutual labels:  files, fs
write-yaml
Basic node.js utility for converting JSON to YAML and writing formatting YAML files to disk.
Stars: ✭ 38 (-54.76%)
Mutual labels:  fs, write
matched
Glob matching with support for multiple patterns and negation. Use `~` in cwd to find files in user home, or `@` for global npm modules.
Stars: ✭ 25 (-70.24%)
Mutual labels:  files, fs
Copy Webpack Plugin
Copy files and directories with webpack
Stars: ✭ 2,679 (+3089.29%)
Mutual labels:  files, copy
bash-glob
Bash-powered globbing for node.js. Alternative to node-glob. Does not work on Windows 9 and lower.
Stars: ✭ 13 (-84.52%)
Mutual labels:  files, fs
glob-fs
file globbing for node.js. speedy and powerful alternative to node-glob. This library is experimental and does not work on windows!
Stars: ✭ 54 (-35.71%)
Mutual labels:  files, fs
Xcv
βœ‚οΈ Cut, Copy and Paste files with Bash
Stars: ✭ 144 (+71.43%)
Mutual labels:  files, copy
go-storage
A vendor-neutral storage library for Golang: Write once, run on every storage service.
Stars: ✭ 387 (+360.71%)
Mutual labels:  files, fs
speedcopy
Patched python shutil.copyfile to allow faster speeds on samba shares.
Stars: ✭ 13 (-84.52%)
Mutual labels:  files, copy
is-directory
Extends `stats.isDirectory()`, returns `true` if a filepath is a directory.
Stars: ✭ 28 (-66.67%)
Mutual labels:  fs
pate
Modern and light-fast CLI app that scans all the desired files of a certain folder and returns a list with the name of the files which contain a certain RegEx pattern
Stars: ✭ 23 (-72.62%)
Mutual labels:  fs
node-fs
node-fs
Stars: ✭ 55 (-34.52%)
Mutual labels:  fs
upload
How to Upload a File to a Server in PHP
Stars: ✭ 83 (-1.19%)
Mutual labels:  files
pythonwhat
Verify Python code submissions and auto-generate meaningful feedback messages.
Stars: ✭ 55 (-34.52%)
Mutual labels:  fs

copy NPM version NPM monthly downloads NPM total downloads Linux Build Status Windows Build Status

Copy files or directories using globs.

Table of Contents

(TOC generated by verb using markdown-toc)

Install

Install with npm:

$ npm install --save copy

Usage

var copy = require('copy');

See the API documentation for usage details and available methods.

Examples

The main export is a function that takes:

  • src - glob pattern or file path(s)
  • dest - the destination directory
  • cb - callback function
copy('*.js', 'foo', function(err, files) {
  if (err) throw err;
  // `files` is an array of the files that were copied
});

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

Copy a filepath, vinyl file, array of files, or glob of files to the given destination directory, with options and callback function that exposes err and the array of vinyl files that are created by the copy operation.

Params

  • patterns {String|Object|Array}: Filepath(s), vinyl file(s) or glob of files.
  • dir {String}: Destination directory
  • options {Object|Function}: or callback function
  • cb {Function}: Callback function if no options are specified

Example

copy('*.js', 'dist', function(err, file) {
  // exposes the vinyl `file` created when the file is copied
});

.copy.each

Copy an array of files to the given destination directory, with options and callback function that exposes err and the array of vinyl files that are created by the copy operation.

Params

  • files {Array}: Filepaths or vinyl files.
  • dir {String}: Destination directory
  • options {Object|Function}: or callback function
  • cb {Function}: Callback function if no options are specified

Example

copy.each(['foo.txt', 'bar.txt', 'baz.txt'], 'dist', function(err, files) {
  // exposes the vinyl `files` created when the files are copied
});

.copy.one

Copy a single file to the given dest directory, using the specified options and callback function.

Params

  • file {String|Object}: Filepath or vinyl file
  • dir {String}: Destination directory
  • options {Object|Function}: or callback function
  • cb {Function}: Callback function if no options are specified

Example

copy.one('foo.txt', 'dist', function(err, file) {
  if (err) throw err;
  // exposes the vinyl `file` that is created when the file is copied
});

CLI

To use the CLI, install copy globally with the following command:

$ npm install --global copy

This adds copy to your system path, allowing the copy command to be executed anywhere.

CLI usage

$ copy <patterns> <dir>
  • patterns: glob pattern or array of file paths
  • dir: destination directory

Example

Copy* all files with the .js extension to the foo directory

$ copy *.js foo

*Note that glob patterns may need to be wrapped in quotes depending on the shell you're using.

History

v0.2.0 - breaking changes

About

Related projects

Contributing

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

Contributors

Commits Contributor
61 jonschlinkert
2 joakimbeng
1 bleathem
1 doowb
1 gsantiago
1 SoulRIver2015

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright Β© 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on September 01, 2017.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].