{"id":15003531,"url":"https://github.com/jonschlinkert/copy","last_synced_at":"2025-04-04T21:09:41.862Z","repository":{"id":34528179,"uuid":"38470852","full_name":"jonschlinkert/copy","owner":"jonschlinkert","description":"Copy files using glob patterns. Sync, async, promise or streams. (node.js utility)","archived":false,"fork":false,"pushed_at":"2022-02-10T20:02:12.000Z","size":72,"stargazers_count":94,"open_issues_count":11,"forks_count":126,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-05-01T22:11:34.628Z","etag":null,"topics":["copy","files","fs","javascript","node","nodejs","write","writefile"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonschlinkert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-03T03:54:43.000Z","updated_at":"2024-01-31T10:57:56.000Z","dependencies_parsed_at":"2022-08-08T01:15:12.721Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/copy","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fcopy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fcopy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fcopy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fcopy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/copy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247117756,"owners_count":20886439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["copy","files","fs","javascript","node","nodejs","write","writefile"],"created_at":"2024-09-24T18:58:52.266Z","updated_at":"2025-04-04T21:09:41.844Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","readme":"# copy [![NPM version](https://img.shields.io/npm/v/copy.svg?style=flat)](https://www.npmjs.com/package/copy) [![NPM monthly downloads](https://img.shields.io/npm/dm/copy.svg?style=flat)](https://npmjs.org/package/copy)  [![NPM total downloads](https://img.shields.io/npm/dt/copy.svg?style=flat)](https://npmjs.org/package/copy) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/copy.svg?style=flat\u0026label=Travis)](https://travis-ci.org/jonschlinkert/copy) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/copy.svg?style=flat\u0026label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/copy)\n\n\u003e Copy files or directories using globs.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Examples](#examples)\n- [API](#api)\n- [CLI](#cli)\n- [History](#history)\n- [About](#about)\n\n_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save copy\n```\n\n## Usage\n\n```js\nvar copy = require('copy');\n```\n\nSee the [API documentation](#api) for usage details and available methods.\n\n## Examples\n\nThe main export is a function that takes:\n\n* `src` - glob pattern or file path(s)\n* `dest` - the destination directory\n* `cb` - callback function\n\n```js\ncopy('*.js', 'foo', function(err, files) {\n  if (err) throw err;\n  // `files` is an array of the files that were copied\n});\n```\n\n**Usage with [gulp](http://gulpjs.com)**\n\nIn your project's gulpfile.js:\n\n```js\nvar gulp = require('gulp');\nvar copy = require('copy');\n\ngulp.task('default', function (cb) {\n  copy('fixtures/*.txt', 'actual', cb);\n});\n```\n\n## API\n\n### [copy](index.js#L27)\n\nCopy 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.\n\n**Params**\n\n* `patterns` **{String|Object|Array}**: Filepath(s), vinyl file(s) or glob of files.\n* `dir` **{String}**: Destination directory\n* `options` **{Object|Function}**: or callback function\n* `cb` **{Function}**: Callback function if no options are specified\n\n**Example**\n\n```js\ncopy('*.js', 'dist', function(err, file) {\n  // exposes the vinyl `file` created when the file is copied\n});\n```\n\n### [.copy.each](index.js#L79)\n\nCopy 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.\n\n**Params**\n\n* `files` **{Array}**: Filepaths or vinyl files.\n* `dir` **{String}**: Destination directory\n* `options` **{Object|Function}**: or callback function\n* `cb` **{Function}**: Callback function if no options are specified\n\n**Example**\n\n```js\ncopy.each(['foo.txt', 'bar.txt', 'baz.txt'], 'dist', function(err, files) {\n  // exposes the vinyl `files` created when the files are copied\n});\n```\n\n### [.copy.one](index.js#L132)\n\nCopy a single `file` to the given `dest` directory, using the specified options and callback function.\n\n**Params**\n\n* `file` **{String|Object}**: Filepath or vinyl file\n* `dir` **{String}**: Destination directory\n* `options` **{Object|Function}**: or callback function\n* `cb` **{Function}**: Callback function if no options are specified\n\n**Example**\n\n```js\ncopy.one('foo.txt', 'dist', function(err, file) {\n  if (err) throw err;\n  // exposes the vinyl `file` that is created when the file is copied\n});\n```\n\n## CLI\n\nTo use the CLI, install `copy` globally with the following command:\n\n```js\n$ npm install --global copy\n```\n\nThis adds `copy` to your system path, allowing the `copy` command to be executed anywhere.\n\n**CLI usage**\n\n```sh\n$ copy \u003cpatterns\u003e \u003cdir\u003e\n```\n\n* `patterns`: glob pattern or array of file paths\n* `dir`: destination directory\n\n**Example**\n\nCopy* all files with the `.js` extension to the `foo` directory\n\n```sh\n$ copy *.js foo\n```\n\n*Note that glob patterns may need to be wrapped in quotes depending on the shell you're using.\n\n## History\n\n**v0.2.0 - breaking changes**\n\n* The API was changed in 0.2.0. please review the [API documentation](#api)\n\n## About\n\n### Related projects\n\n* [expand-config](https://www.npmjs.com/package/expand-config): Expand tasks, targets and files in a declarative configuration. | [homepage](https://github.com/jonschlinkert/expand-config \"Expand tasks, targets and files in a declarative configuration.\")\n* [expand-files](https://www.npmjs.com/package/expand-files): Expand glob patterns in a declarative configuration into src-dest mappings. | [homepage](https://github.com/jonschlinkert/expand-files \"Expand glob patterns in a declarative configuration into src-dest mappings.\")\n* [expand-target](https://www.npmjs.com/package/expand-target): Expand target definitions in a declarative configuration. | [homepage](https://github.com/jonschlinkert/expand-target \"Expand target definitions in a declarative configuration.\")\n* [expand-task](https://www.npmjs.com/package/expand-task): Expand and normalize task definitions in a declarative configuration. | [homepage](https://github.com/jonschlinkert/expand-task \"Expand and normalize task definitions in a declarative configuration.\")\n* [export-files](https://www.npmjs.com/package/export-files): node.js utility for exporting a directory of files as modules. | [homepage](https://github.com/jonschlinkert/export-files \"node.js utility for exporting a directory of files as modules.\")\n* [write](https://www.npmjs.com/package/write): Write data to a file, replacing the file if it already exists and creating any… [more](https://github.com/jonschlinkert/write) | [homepage](https://github.com/jonschlinkert/write \"Write data to a file, replacing the file if it already exists and creating any intermediate directories if they don't already exist. Thin wrapper around node's native fs methods.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** |  \n| --- | --- |  \n| 61 | [jonschlinkert](https://github.com/jonschlinkert) |  \n| 2  | [joakimbeng](https://github.com/joakimbeng) |  \n| 1  | [bleathem](https://github.com/bleathem) |  \n| 1  | [doowb](https://github.com/doowb) |  \n| 1  | [gsantiago](https://github.com/gsantiago) |  \n| 1  | [SoulRIver2015](https://github.com/SoulRIver2015) |  \n\n### Building docs\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n### Running tests\n\nRunning 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:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on September 01, 2017._","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fcopy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Fcopy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fcopy/lists"}