{"name":"cpy","version":"8.1.1","description":"Copy files","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/cpy.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["copy","cp","cpy","file","files","clone","fs","stream","glob","file-system","ncp","fast","quick","data","content","contents","cpx","directory","directories"],"dependencies":{"arrify":"^2.0.1","cp-file":"^7.0.0","globby":"^9.2.0","has-glob":"^1.0.0","junk":"^3.1.0","nested-error-stacks":"^2.1.0","p-all":"^2.1.0","p-filter":"^2.1.0","p-map":"^3.0.0"},"devDependencies":{"ava":"^3.12.1","proxyquire":"^2.1.3","rimraf":"^3.0.0","tempy":"^0.6.0","tsd":"^0.11.0","xo":"^0.25.3"},"gitHead":"b28be2a5929ed885c03e92d1d04f941f79aa937e","bugs":{"url":"https://github.com/sindresorhus/cpy/issues"},"homepage":"https://github.com/sindresorhus/cpy#readme","_id":"cpy@8.1.1","_nodeVersion":"10.22.0","_npmVersion":"6.14.7","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-vqHT+9o67sMwJ5hUd/BAOYeemkU+MuFRsK2c36Xc3eefQpAsp1kAsyDxEDcc5JS1+y9l/XHPrIsVTcyGGmkUUQ==","shasum":"066ed4c6eaeed9577df96dae4db9438c1a90df62","tarball":"http://registry-npm.ywwl.com/cpy/download/cpy-8.1.1.tgz","fileCount":6,"unpackedSize":12970,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfUCxjCRA9TVsSAnZWagAARdIP/2CUHPpDxcMvnO7zzwpA\nIOJcoVw4Zhu5I9ZLTysRZxxY4mWpUxSdonC7xOCzX2Lvn1ybtKlOaQyMC46+\ny+5v3OOxDcr6tMbb41VwMmsDBi+ULzQdidryWaCaLnMZOfQnlf2JI1DNA+pu\nIC3wviJePHsfQj9FRGsR24nZUMG/p+gC8XPDQLAjnAgbmb6o57IIwA7zWzWs\nzNC0Z0xOdF8tDnxpTCrxYp/d0te96Asa82FpK6g9/MLfnhRi/ljrameqrptX\n+S/b9W434glAOWaGLW4583Sl1hfKa8Lti1o6Gw050b55c3Q2fVOPT5PThX+F\n44fQE7m4ZRu9LiyOUFNjR+BL0V5VbKvsGCEW0Vq/fXJihlAeVMnuvqcs0eMI\nF1Ro4r1fpzo9EwDJuzeg209ACYgUloN6paIMQjDXnxwieuvEPAjOTpSx46oB\nAB5RkEI2eTMv51ylVTvVO9rtO757xnN8V2RpQvFYMINYS8RicZsiZGwXzKnF\n//0XbpBCJ7zIEYtsee93WVsxCCI8UZUXmxznkdzvxt/jLKCBECV7ecjb5zXp\n25RH5dkwFRJIzNVlptXy+VBcLI3n3zhzaFzMu/jQXFXTRxSEEUiEgMb0RqQs\nYdATMrHK2B2eV9RqQ0Y1P0aYlMJ6Tdb1rqDuFECR6JjJ5S5R/47IjlB8wcPw\n3CMp\r\n=vSfD\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC8gwAZwoAeJK+RxO0IgnG/YJk+SFQG0EaAmWlEu67g4AIhAMYHbPvSkOZY3/mxLlJ4Fz/C15Eiz37r/EhsHZowjmDH"}],"size":4556,"noattachment":false,"key":"/cpy/-/cpy-8.1.1.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/cpy_8.1.1_1599089763406_0.7407131353953966"},"_hasShrinkwrap":false,"readme":"# cpy\n\n> Copy files\n\n**IMPORTANT:** This package has a lot of problems and I unfortunately don't have time to fix them. I would recommend against using this package until these problems are resolved. Help welcome (see the issue tracker) 🙏\n\n## Why\n\n- Fast by [cloning](https://stackoverflow.com/questions/71629903/node-js-why-we-should-use-copyfile-ficlone-and-copyfile-ficlone-force-what-is) the files whenever possible.\n- Resilient by using [graceful-fs](https://github.com/isaacs/node-graceful-fs).\n- User-friendly by accepting [globs](https://github.com/sindresorhus/globby#globbing-patterns) and creating non-existent destination directories.\n- User-friendly error messages.\n- Progress reporting.\n\n## Install\n\n```sh\nnpm install cpy\n```\n\n## Usage\n\n```js\nimport cpy from 'cpy';\n\nawait cpy([\n\t'source/*.png', // Copy all .png files\n\t'!source/goat.png', // Ignore goat.png\n], 'destination');\n\n// Copy node_modules to destination/node_modules\nawait cpy('node_modules', 'destination');\n\n// Copy node_modules content to destination\nawait cpy('node_modules/**', 'destination');\n\n// Copy node_modules structure but skip all files except package.json files\nawait cpy('node_modules/**/*.json', 'destination');\n\n// Copy all png files into destination without keeping directory structure\nawait cpy('**/*.png', 'destination', {flat: true});\n\nconsole.log('Files copied!');\n```\n\n## API\n\n### cpy(source, destination, options?)\n\nReturns a `Promise<string[]>` with the destination file paths.\n\n#### source\n\nType: `string | string[]`\n\nFiles to copy.\n\nIf any of the files do not exist, an error will be thrown (does not apply to globs).\n\n#### destination\n\nType: `string`\n\nDestination directory.\n\n#### options\n\nType: `object`\n\nOptions are passed to [globby](https://github.com/sindresorhus/globby#options).\n\nIn addition, you can specify the below options.\n\n##### cwd\n\nType: `string`\\\nDefault: `process.cwd()`\n\nWorking directory to find source files.\n\n##### overwrite\n\nType: `boolean`\\\nDefault: `true`\n\nOverwrite existing files.\n\n##### flat\n\nType: `boolean`\\\nDefault: `false`\n\nFlatten directory structure. All copied files will be put in the same directory.\n\n```js\nimport cpy from 'cpy';\n\nawait cpy('src/**/*.js', 'destination', {\n\tflat: true\n});\n```\n\n##### rename\n\nType: `string | Function`\n\nFilename or function returning a filename used to rename every file in `source`.\n\n```js\nimport cpy from 'cpy';\n\nawait cpy('foo.js', 'destination', {\n\t// The `basename` is the filename with extension.\n\trename: basename => `prefix-${basename}`\n});\n\nawait cpy('foo.js', 'destination', {\n\trename: 'new-name'\n});\n```\n\n##### concurrency\n\nType: `number`\\\nDefault: `(os.cpus().length || 1) * 2`\n\nNumber of files being copied concurrently.\n\n##### ignoreJunk\n\nType: `boolean`\\\nDefault: `true`\n\nIgnores [junk](https://github.com/sindresorhus/junk) files.\n\n##### filter\n\nType: `Function`\n\nFunction to filter files to copy.\n\nReceives a source file object as the first argument.\n\nReturn true to include, false to exclude. You can also return a Promise that resolves to true or false.\n\n```js\nimport cpy from 'cpy';\n\nawait cpy('foo', 'destination', {\n\tfilter: file => file.extension !== 'nocopy'\n});\n```\n\n##### Source file object\n\n###### path\n\nType: `string`\\\nExample: `'/tmp/dir/foo.js'`\n\nResolved path to the file.\n\n###### relativePath\n\nType: `string`\\\nExample: `'dir/foo.js'` if `cwd` was `'/tmp'`\n\nRelative path to the file from `cwd`.\n\n###### name\n\nType: `string`\\\nExample: `'foo.js'`\n\nFilename with extension.\n\n###### nameWithoutExtension\n\nType: `string`\\\nExample: `'foo'`\n\nFilename without extension.\n\n###### extension\n\nType: `string`\\\nExample: `'js'`\n\nFile extension.\n\n## Progress reporting\n\n### cpy.on('progress', handler)\n\n#### handler(progress)\n\nType: `Function`\n\n##### progress\n\n```js\n{\n\tcompletedFiles: number,\n\ttotalFiles: number,\n\tcompletedSize: number,\n\tpercent: number,\n\tsourcePath: string,\n\tdestinationPath: string,\n}\n```\n\n- `completedSize` is in bytes\n- `percent` is a value between `0` and `1`\n- `sourcePath` is the absolute source path of the current file being copied.\n- `destinationPath` is The absolute destination path of the current file being copied.\n\nNote that the `.on()` method is available only right after the initial `cpy` call, so make sure you add a `handler` before awaiting the promise:\n\n```js\nimport cpy from 'cpy';\n\nawait cpy(source, destination).on('progress', progress => {\n\t// …\n});\n```\n\n## Related\n\n- [cpy-cli](https://github.com/sindresorhus/cpy-cli) - CLI for this module\n- [copy-file](https://github.com/sindresorhus/copy-file) - Copy a single file\n- [move-file](https://github.com/sindresorhus/move-file) - Move a file\n- [make-dir](https://github.com/sindresorhus/make-dir) - Make a directory and its parents if needed\n","publish_time":1599089763558,"_cnpm_publish_time":1599089763558,"dist-tags":{"latest":"13.2.3"}}