{"_id":"copy-dir","_rev":"2906306","name":"copy-dir","description":"copy-dir","dist-tags":{"latest":"1.3.0"},"maintainers":[{"name":"pillys","email":"chenbl@liepin.com"}],"time":{"modified":"2022-12-14T07:20:01.000Z","created":"2015-12-03T14:54:41.201Z","1.3.0":"2020-05-27T02:19:03.129Z","1.2.0":"2019-08-21T15:03:14.999Z","1.1.0":"2019-05-14T15:06:08.985Z","1.0.0":"2019-05-03T08:54:27.893Z","0.4.0":"2018-07-14T02:32:10.195Z","0.3.0":"2016-07-02T07:35:06.567Z","0.2.0":"2016-06-28T02:51:58.904Z","0.1.0":"2016-06-27T18:41:09.571Z","0.0.8":"2015-12-03T14:54:41.201Z"},"users":{},"author":{"name":"pillys","email":"pillys@163.com","url":"https://www.qque.com"},"repository":{"url":"git+https://github.com/pillys/copy-dir.git","type":"git"},"versions":{"1.3.0":{"author":{"name":"pillys","email":"pillys@163.com","url":"https://www.qque.com"},"dependencies":{},"description":"copy-dir","keywords":["copy-dir","copy","copy dir","copy directory","copy file"],"main":"index.js","name":"copy-dir","repository":{"url":"git+https://github.com/pillys/copy-dir.git","type":"git"},"version":"1.3.0","bugs":{"url":"https://github.com/pillys/copy-dir/issues"},"homepage":"https://github.com/pillys/copy-dir","scripts":{},"license":"MIT","gitHead":"dbda8b6c1a30f15c59545bdb4b1b8f30be02b9a3","_id":"copy-dir@1.3.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"pillys","email":"pillys@163.com"},"dist":{"shasum":"8c65130e11d8313a6ac2c0578e4c6c6f70b456ba","size":3402,"noattachment":false,"key":"/copy-dir/-/copy-dir-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/copy-dir/download/copy-dir-1.3.0.tgz"},"maintainers":[{"name":"pillys","email":"chenbl@liepin.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/copy-dir_1.3.0_1590545942977_0.417022172011994"},"_hasShrinkwrap":false,"publish_time":1590545943129,"_cnpm_publish_time":1590545943129,"_cnpmcore_publish_time":"2021-12-16T19:42:02.208Z"},"1.2.0":{"author":{"name":"pillys","email":"pillys@163.com","url":"https://www.qque.com"},"dependencies":{},"description":"copy-dir","keywords":["copy-dir","copy","copy dir","copy directory","copy file"],"main":"index.js","name":"copy-dir","repository":{"url":"git+https://github.com/pillys/copy-dir.git","type":"git"},"version":"1.2.0","bugs":{"url":"https://github.com/pillys/copy-dir/issues"},"homepage":"https://github.com/pillys/copy-dir","scripts":{},"license":"MIT","gitHead":"e43950edccd07a8ad0bf391dafce43637aacdbe1","_id":"copy-dir@1.2.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"pillys","email":"pillys@163.com"},"dist":{"shasum":"d2634378186d8762769285b36efb307a7945964e","size":3359,"noattachment":false,"key":"/copy-dir/-/copy-dir-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/copy-dir/download/copy-dir-1.2.0.tgz"},"maintainers":[{"name":"pillys","email":"chenbl@liepin.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/copy-dir_1.2.0_1566399794845_0.2680733682918386"},"_hasShrinkwrap":false,"publish_time":1566399794999,"_cnpm_publish_time":1566399794999,"_cnpmcore_publish_time":"2021-12-16T19:42:02.539Z"},"1.1.0":{"author":{"name":"pillys","email":"pillys@163.com","url":"https://www.qque.com"},"dependencies":{},"description":"copy-dir","keywords":["copy-dir","copy","copy dir","copy directory","copy file"],"main":"index.js","name":"copy-dir","repository":{"url":"git+https://github.com/pillys/copy-dir.git","type":"git"},"version":"1.1.0","bugs":{"url":"https://github.com/pillys/copy-dir/issues"},"homepage":"https://github.com/pillys/copy-dir","scripts":{},"license":"MIT","gitHead":"527c680da6fbcccc0591be5e23d2bf175a8bdbd3","_id":"copy-dir@1.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"pillys","email":"pillys@163.com"},"dist":{"shasum":"856f38609709b4f061a83254c3fb595b8bfb8974","size":3352,"noattachment":false,"key":"/copy-dir/-/copy-dir-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/copy-dir/download/copy-dir-1.1.0.tgz"},"maintainers":[{"name":"pillys","email":"chenbl@liepin.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/copy-dir_1.1.0_1557846368879_0.8877124979567612"},"_hasShrinkwrap":false,"publish_time":1557846368985,"_cnpm_publish_time":1557846368985,"_cnpmcore_publish_time":"2021-12-16T19:42:02.909Z"},"1.0.0":{"author":{"name":"pillys","email":"pillys@163.com","url":"https://www.qque.com"},"dependencies":{},"description":"copy-dir","keywords":["copy-dir","copy","copy dir","copy directory","copy file"],"main":"index.js","name":"copy-dir","repository":{"url":"git+https://github.com/pillys/copy-dir.git","type":"git"},"version":"1.0.0","bugs":{"url":"https://github.com/pillys/copy-dir/issues"},"homepage":"https://github.com/pillys/copy-dir","scripts":{},"license":"MIT","gitHead":"4425852b84c58772e337143ee20defa603e9758d","_id":"copy-dir@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.12.0","_npmUser":{"name":"pillys","email":"pillys@163.com"},"dist":{"shasum":"12de280b909afbff893b8578c59c3d33f4cccd4e","size":3341,"noattachment":false,"key":"/copy-dir/-/copy-dir-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/copy-dir/download/copy-dir-1.0.0.tgz"},"maintainers":[{"name":"pillys","email":"chenbl@liepin.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/copy-dir_1.0.0_1556873667768_0.9230126034431434"},"_hasShrinkwrap":false,"publish_time":1556873667893,"_cnpm_publish_time":1556873667893,"_cnpmcore_publish_time":"2021-12-16T19:42:03.164Z"},"0.4.0":{"author":{"name":"pillys","email":"pillys@163.com","url":"http://www.qque.com"},"dependencies":{"mkdir-p":"~0.0.4"},"description":"copy-dir","keywords":["copy-dir","copy","copy dir","copy directory","copy file"],"main":"index.js","name":"copy-dir","repository":{"url":"git+https://github.com/pillys/copy-dir.git","type":"git"},"version":"0.4.0","bugs":{"url":"https://github.com/pillys/copy-dir/issues"},"homepage":"https://github.com/pillys/copy-dir","scripts":{},"license":"MIT","gitHead":"0d58a23fa268522897f39c3e8f4c796d69ba0eb3","_id":"copy-dir@0.4.0","_npmVersion":"5.6.0","_nodeVersion":"9.5.0","_npmUser":{"name":"pillys","email":"pillys@163.com"},"dist":{"shasum":"bb7f603890ec20bf14678cbd6735fa46fc156be7","size":2878,"noattachment":false,"key":"/copy-dir/-/copy-dir-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/copy-dir/download/copy-dir-0.4.0.tgz"},"maintainers":[{"name":"pillys","email":"chenbl@liepin.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/copy-dir_0.4.0_1531535530018_0.06442833332913755"},"_hasShrinkwrap":false,"publish_time":1531535530195,"_cnpm_publish_time":1531535530195,"_cnpmcore_publish_time":"2021-12-16T19:42:03.367Z"},"0.3.0":{"author":{"name":"pillys","email":"pillys@163.com","url":"http://www.qque.com"},"dependencies":{"mkdir-p":"~0.0.4"},"description":"copy-dir","keywords":["copy-dir","copy","copy dir","copy directory","copy file"],"main":"index.js","name":"copy-dir","repository":{"url":"git+https://github.com/pillys/copy-dir.git","type":"git"},"version":"0.3.0","bugs":{"url":"https://github.com/pillys/copy-dir/issues"},"homepage":"https://github.com/pillys/copy-dir","scripts":{},"license":"MIT","gitHead":"dcc190a3bfa8338df9bc1d1ff4869198d65b491f","_id":"copy-dir@0.3.0","_shasum":"deb2dc2fa9c9290ed47c84155a999a6d45f5a358","_from":".","_npmVersion":"3.8.9","_nodeVersion":"5.8.0","_npmUser":{"name":"pillys","email":"pillys@163.com"},"dist":{"shasum":"deb2dc2fa9c9290ed47c84155a999a6d45f5a358","size":2897,"noattachment":false,"key":"/copy-dir/-/copy-dir-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/copy-dir/download/copy-dir-0.3.0.tgz"},"maintainers":[{"name":"pillys","email":"chenbl@liepin.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/copy-dir-0.3.0.tgz_1467444905922_0.06344772223383188"},"directories":{},"publish_time":1467444906567,"_hasShrinkwrap":false,"_cnpm_publish_time":1467444906567,"_cnpmcore_publish_time":"2021-12-16T19:42:03.567Z"},"0.2.0":{"author":{"name":"pillys","email":"pillys@163.com","url":"http://www.qque.com"},"dependencies":{"mkdir-p":"~0.0.4"},"description":"copy-dir","keywords":["copy-dir","copy","copy dir","copy directory","copy file"],"main":"index.js","name":"copy-dir","repository":{"url":"git+https://github.com/pillys/copy-dir.git","type":"git"},"version":"0.2.0","bugs":{"url":"https://github.com/pillys/copy-dir/issues"},"homepage":"https://github.com/pillys/copy-dir","scripts":{},"license":"MIT","gitHead":"7cbae68f13b803bb95e50cbcdb70dcb8faf92911","_id":"copy-dir@0.2.0","_shasum":"a986aad94c765078a24322db0a761c823105d0a2","_from":".","_npmVersion":"3.8.9","_nodeVersion":"5.8.0","_npmUser":{"name":"pillys","email":"pillys@163.com"},"dist":{"shasum":"a986aad94c765078a24322db0a761c823105d0a2","size":2889,"noattachment":false,"key":"/copy-dir/-/copy-dir-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/copy-dir/download/copy-dir-0.2.0.tgz"},"maintainers":[{"name":"pillys","email":"chenbl@liepin.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/copy-dir-0.2.0.tgz_1467082316572_0.10467162216082215"},"directories":{},"publish_time":1467082318904,"_hasShrinkwrap":false,"_cnpm_publish_time":1467082318904,"_cnpmcore_publish_time":"2021-12-16T19:42:03.788Z"},"0.1.0":{"author":{"name":"pillys","email":"pillys@163.com","url":"http://www.qque.com"},"dependencies":{"mkdir-p":"~0.0.4"},"description":"copy-dir","keywords":["copy-dir","copy","copy dir","copy directory","copy file"],"main":"index.js","name":"copy-dir","repository":{"url":"git+https://github.com/pillys/copy-dir.git","type":"git"},"version":"0.1.0","bugs":{"url":"https://github.com/pillys/copy-dir/issues"},"homepage":"https://github.com/pillys/copy-dir","scripts":{},"license":"MIT","gitHead":"4b71095ee7d26842b890287860cfab0294a11fd4","_id":"copy-dir@0.1.0","_shasum":"876262ef995addd9b015bfbd4e96b4514d3bdce8","_from":".","_npmVersion":"3.8.9","_nodeVersion":"5.8.0","_npmUser":{"name":"pillys","email":"pillys@163.com"},"dist":{"shasum":"876262ef995addd9b015bfbd4e96b4514d3bdce8","size":2738,"noattachment":false,"key":"/copy-dir/-/copy-dir-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/copy-dir/download/copy-dir-0.1.0.tgz"},"maintainers":[{"name":"pillys","email":"chenbl@liepin.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/copy-dir-0.1.0.tgz_1467052867177_0.274663204792887"},"directories":{},"publish_time":1467052869571,"_hasShrinkwrap":false,"_cnpm_publish_time":1467052869571,"_cnpmcore_publish_time":"2021-12-16T19:42:03.984Z"},"0.0.8":{"author":{"name":"pillys","email":"pilly@163.com","url":"http://www.qque.com"},"dependencies":{"mkdir-p":"~0.0.4"},"description":"copy-dir","keywords":["copy-dir","copy","copy dir","copy directory","copy file"],"main":"index.js","name":"copy-dir","repository":{"url":"git+https://github.com/pillys/copy-dir.git","type":"git"},"version":"0.0.8","bugs":{"url":"https://github.com/pillys/copy-dir/issues"},"homepage":"https://github.com/pillys/copy-dir","scripts":{},"_id":"copy-dir@0.0.8","_shasum":"3f4fe3a1c27bed420bd30ecdcba3cdc98d6397c4","_from":".","_npmVersion":"2.14.4","_nodeVersion":"4.1.1","_npmUser":{"name":"pillys","email":"chenbl@liepin.com"},"dist":{"shasum":"3f4fe3a1c27bed420bd30ecdcba3cdc98d6397c4","size":1821,"noattachment":false,"key":"/copy-dir/-/copy-dir-0.0.8.tgz","tarball":"http://registry.cnpm.dingdandao.com/copy-dir/download/copy-dir-0.0.8.tgz"},"maintainers":[{"name":"pillys","email":"chenbl@liepin.com"}],"directories":{},"publish_time":1449154481201,"_hasShrinkwrap":false,"_cnpm_publish_time":1449154481201,"_cnpmcore_publish_time":"2021-12-16T19:42:04.177Z"}},"readme":"# copy-dir\r\n\r\n  Easy used 'copy-dir' lib, even use a filter, copy a file or directory to another path, when target path or parent target path not exists, it will create the directory automatically.\r\n\r\n# install\r\n\r\n```js\r\nnpm install copy-dir\r\n```\r\n\r\n# grammar\r\n\r\nSync Mode:\r\n\r\n```js\r\ncopydir.sync(from, to[, options]);\r\n```\r\n\r\nAsync Mode:\r\n\r\n```js\r\ncopydir(from, to, [options, ]callback);\r\n```\r\n\r\n[options]:\r\n\r\n```js\r\n  utimes: false,  // Boolean | Object, keep addTime or modifyTime if true\r\n  mode: false,    // Boolean | Number, keep file mode if true\r\n  cover: true,    // Boolean, cover if file exists\r\n  filter: true,   // Boolean | Function, file filter\r\n```\r\n\r\nfilter is a function that you want to filter the path, then return true or false.\r\n\r\nIt can use three arguments named state, filepath, filename\r\n\r\n* state: String, 'file' / 'directory' / 'symbolicLink', marked as the file or path type\r\n* filepath: String, the file path\r\n* filename: String, the file name\r\n\r\n# usage\r\n\r\nSync Mode:\r\n\r\n```js\r\nvar copydir = require('copy-dir');\r\n\r\ncopydir.sync('/my/from/path', '/my/target/path', {\r\n  utimes: true,  // keep add time and modify time\r\n  mode: true,    // keep file mode\r\n  cover: true    // cover file when exists, default is true\r\n});\r\n```\r\n\r\nAsync Mode:\r\n\r\n```js\r\nvar copydir = require('copy-dir');\r\n\r\ncopydir('/my/from/path', '/my/target/path', {\r\n  utimes: true,  // keep add time and modify time\r\n  mode: true,    // keep file mode\r\n  cover: true    // cover file when exists, default is true\r\n}, function(err){\r\n  if(err) throw err;\r\n  console.log('done');\r\n});\r\n```\r\n\r\n# add a filter\r\n\r\nWhen you want to copy a directory, but some file or sub directory is not you want, you can do like this:\r\n\r\nSync Mode:\r\n\r\n```js\r\nvar path = require('path');\r\nvar copydir = require('copy-dir');\r\n\r\ncopydir.sync('/my/from/path', '/my/target/path', {\r\n  filter: function(stat, filepath, filename){\r\n    // do not want copy .html files\r\n    if(stat === 'file' && path.extname(filepath) === '.html') {\r\n      return false;\r\n    }\r\n    // do not want copy .svn directories\r\n    if (stat === 'directory' && filename === '.svn') {\r\n      return false;\r\n    }\r\n    // do not want copy symbolicLink directories\r\n    if (stat === 'symbolicLink') {\r\n      return false;\r\n    }\r\n    return true;  // remind to return a true value when file check passed.\r\n  }\r\n});\r\nconsole.log('done');\r\n```\r\n\r\nAsync Mode:\r\n\r\n```js\r\nvar path = require('path');\r\nvar copydir = require('copy-dir');\r\n\r\ncopydir('/a/b/c', '/a/b/e', {\r\n  filter: function(stat, filepath, filename) {\r\n    //...\r\n    return true;\r\n  }\r\n}, function(err) {\r\n  //...\r\n});\r\n```\r\n\r\n## Update Logs\r\n\r\n# 1.3.0\r\n\r\nBug fix: filter function arguments incorrect, delete the third argument: dirname\r\n\r\n## Questions?\r\n\r\nIf you have any questions, please feel free to ask through [New Issue](https://github.com/pillys/copy-dir/issues/new).\r\n\r\n### License\r\n\r\ncopy-dir is available under the terms of the [MIT](LICENSE) License.\r\n","_attachments":{},"homepage":"https://github.com/pillys/copy-dir","bugs":{"url":"https://github.com/pillys/copy-dir/issues"},"license":"MIT"}