@ apexearth/ 副本
通过命令行或节点.js复制文件.
为什么?
- 通过国家保存恢复能力,可以复制数十万个文件,而不必重新开始.
- 并行传输可以提高较小文件在Samba等网络连接上传输的速度.
- 因为有时候你需要复制 许多 东西!
安装
节点使用
$ npm i @apexearth/copy
命令行使用量
$ npm i @apexearth/copy -g
使用量
节点使用
const copy = require('@apexearth/copy')
copy({
from, // Source copy path.
to, // Destination copy path.
recursive, // Copy recursively.
overwrite, // Overwrite existing file
overwriteMismatches, // Overwrite if size mismatch or from modified date is more recent.
verbose, // Verbose output.
json, // JSON output. (options: true, "pretty")
ignoreErrors, // Continue on errors.
parallelJobs, // Number of possible concurrent jobs.
state, // Save state for resume ability.
stateFrequency, // Save state frequency.
copyFile, // Supply your own copyFile function. (from, to, cb)
readdir, // Supply your own readdir function. (path, cb)
stat, // Supply your own stat function. (path, cb)
})
.then(() => console.log('done'))
.catch(err => console.error(err))
命令行使用量
Usage: node-copy [options] <from> <to>
Options:
-V, --version output the version number
-r, --recursive Copy recursively.
-o, --overwrite Overwrite existing.
--overwrite-mismatches Overwrite if size mismatch or from modified date is more recent.
-v, --verbose Verbose output.
-j, --json <format> JSON output. (options: true, pretty)
-e, --ignore-errors Ignore errors.
-p, --parallel-jobs <n> Number of possible concurrent jobs. (default: 1)
-s, --state <file> Save state to file for resume ability.
--state-frequency <n> Save state frequency. (In <n> files saved.) (default: 100)
-a, --archive <state-file> Attempt to copy as much as possible using options `-mervs <state-file> -p 4` with restart capabilities.
-h, --help output usage information