{"name":"copy-file","description":"Copies a file","author":{"name":"Chris Khoo"},"version":"0.0.1","main":"src/index.js","licenses":[{"type":"MIT","url":"http://opensource.org/licenses/mit-license.php"}],"engines":{"node":">=0.6.18"},"_npmUser":{"name":"khoomeister","email":"chris.khoo@gmail.com"},"_id":"copy-file@0.0.1","dependencies":{},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"a772f8d7eb36c8371513ff80bbaade314129dd59","tarball":"http://registry-npm.ywwl.com/copy-file/download/copy-file-0.0.1.tgz","integrity":"sha512-E2S/iYY3HIC3zevt3zGL/qrhlyhqgdGFEDIh3zyTTslMsI39Ut70yZvPnsYGUeqfhWCzY+X/WvqBnWPxsLtcww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCCoEuJ4/0sLkWSMpCn3vTKNf++ZUkzc15rUVyT5MAtSQIhAMOGsgCvrXJVC9hSTfu5SJ7cZKUgthiplYC28Q4oVDDU"}],"size":643,"noattachment":false,"key":"/copy-file/-/copy-file-0.0.1.tgz"},"readme":"# copy-file\n\n> Copy a file\n\n## Highlights\n\n- It's super fast by [cloning](https://stackoverflow.com/questions/71629903/node-js-why-we-should-use-copyfile-ficlone-and-copyfile-ficlone-force-what-is) the file whenever possible.\n- Resilient by using [graceful-fs](https://github.com/isaacs/node-graceful-fs).\n- User-friendly by creating non-existent destination directories for you.\n- Can be safe by turning off [overwriting](#overwrite).\n- Preserves file mode [but not ownership](https://github.com/sindresorhus/copy-file/issues/22#issuecomment-502079547).\n- User-friendly errors.\n\n## Install\n\n```sh\nnpm install copy-file\n```\n\n## Usage\n\n```js\nimport {copyFile} from 'copy-file';\n\nawait copyFile('source/unicorn.png', 'destination/unicorn.png');\nconsole.log('File copied');\n```\n\n## API\n\n### copyFile(source, destination, options?)\n\nReturns a `Promise` that resolves when the file is copied.\n\nThe file is cloned if the `onProgress` option is not passed and the [file system supports it](https://stackoverflow.com/a/76496347/64949).\n\n### copyFileSync(source, destination, options?)\n\n#### source\n\nType: `string`\n\nThe file you want to copy.\n\nThe file is cloned if the [file system supports it](https://stackoverflow.com/a/76496347/64949).\n\n#### destination\n\nType: `string`\n\nWhere you want the file copied.\n\n#### options\n\nType: `object`\n\n##### overwrite\n\nType: `boolean`\\\nDefault: `true`\n\nOverwrite existing destination file.\n\n##### cwd\n\nType: `string`\\\nDefault: `process.cwd()`\n\nThe working directory to find source files.\n\nThe source and destination path are relative to this.\n\n##### directoryMode\n\nType: `number`\\\nDefault: `0o777`\n\n[Permissions](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation) for created directories.\n\nIt has no effect on Windows.\n\n##### onProgress\n\nType: `(progress: ProgressData) => void`\n\nThe given function is called whenever there is measurable progress.\n\nOnly available when using the async method.\n\n###### `ProgressData`\n\n```js\n{\n\tsourcePath: string,\n\tdestinationPath: string,\n\tsize: number,\n\twrittenBytes: number,\n\tpercent: number\n}\n```\n\n- `sourcePath` and `destinationPath` are absolute paths.\n- `size` and `writtenBytes` are in bytes.\n- `percent` is a value between `0` and `1`.\n\n###### Notes\n\n- For empty files, the `onProgress` callback function is emitted only once.\n\n```js\nimport {copyFile} from 'copy-file';\n\nawait copyFile(source, destination, {\n\tonProgress: progress => {\n\t\t// …\n\t}\n});\n```\n\n## Related\n\n- [cpy](https://github.com/sindresorhus/cpy) - Copy files\n- [cpy-cli](https://github.com/sindresorhus/cpy-cli) - Copy files on the command-line\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","maintainers":[{"name":"khoomeister","email":"chris.khoo@gmail.com"}],"directories":{},"publish_time":1338552971448,"_cnpm_publish_time":1338552971448,"dist-tags":{"latest":"11.1.0"}}