{"_id":"fileutil","_rev":"1212511","name":"fileutil","description":"an easy file operation utility","dist-tags":{"latest":"1.1.1"},"maintainers":[{"name":"colorhook","email":"colorhook@gmail.com"}],"time":{"modified":"2021-10-13T05:46:12.000Z","created":"2012-12-06T06:22:40.398Z","1.1.1":"2013-05-03T04:12:07.713Z","1.1.0":"2013-01-10T02:53:53.752Z","1.0.0":"2012-12-06T06:22:40.398Z"},"users":{},"author":{"name":"colorhook","email":"colorhook@gmail.com"},"repository":{"type":"git","url":"git://github.com/colorhook/fileutil.git"},"versions":{"1.1.1":{"name":"fileutil","version":"1.1.1","description":"an easy file operation utility","keywords":["synchronous file operation","touch, move, mkdir, copy"],"main":"lib/fileutil.js","engines":{"node":">=0.8.0"},"author":{"name":"colorhook","email":"colorhook@gmail.com"},"maintainers":[{"name":"colorhook","email":"colorhook@gmail.com"}],"bugs":{"email":"colorhook@gmail.com","url":"http://github.com/colorhook/fileutil/issues"},"dependencies":{"wrench":"~1.4.4"},"devDependencies":{"mocha":"~1.7.4","should":"~1.2.1"},"scripts":{"test":"mocha --reporter spec --timeout 5000 --require should"},"homepage":"https://github.com/colorhook/fileutil","repository":{"type":"git","url":"git://github.com/colorhook/fileutil.git"},"licenses":[{"type":"MIT","url":"http://github.com/colorhook/fileutil/blob/master/LICENSE"}],"_id":"fileutil@1.1.1","dist":{"shasum":"c2f38e3816dbca8c5ea9da675d45c8bd91a52d21","size":6598,"noattachment":false,"key":"/fileutil/-/fileutil-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/fileutil/download/fileutil-1.1.1.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"colorhook","email":"colorhook@gmail.com"},"directories":{},"publish_time":1367554327713,"_cnpm_publish_time":1367554327713,"_hasShrinkwrap":false},"1.1.0":{"name":"fileutil","version":"1.1.0","description":"an easy file operation utility","keywords":["synchronous file operation","touch, move, mkdir, copy"],"main":"lib/fileutil.js","engines":{"node":">=0.8.0"},"author":{"name":"colorhook","email":"colorhook@gmail.com"},"maintainers":[{"name":"colorhook","email":"colorhook@gmail.com"}],"bugs":{"email":"colorhook@gmail.com","url":"http://github.com/colorhook/fileutil/issues"},"dependencies":{"wrench":"~1.4.4"},"devDependencies":{"mocha":"~1.7.4","should":"~1.2.1"},"scripts":{"test":"mocha --reporter spec --timeout 5000--require should"},"homepage":"https://github.com/colorhook/fileutil","repository":{"type":"git","url":"git://github.com/colorhook/fileutil.git"},"licenses":[{"type":"MIT","url":"http://github.com/colorhook/fileutil/blob/master/LICENSE"}],"_id":"fileutil@1.1.0","dist":{"shasum":"a96c6dd99cf78098bb2b5b23763574cd6562f3a6","size":6516,"noattachment":false,"key":"/fileutil/-/fileutil-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/fileutil/download/fileutil-1.1.0.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"colorhook","email":"colorhook@gmail.com"},"directories":{},"publish_time":1357786433752,"_cnpm_publish_time":1357786433752,"_hasShrinkwrap":false},"1.0.0":{"name":"fileutil","version":"1.0.0","description":"an easy file operation utility","keywords":["synchronous file operation","touch, move, mkdir, copy"],"main":"lib/fileutil.js","engines":{"node":">=0.8.0"},"author":{"name":"colorhook","email":"colorhook@gmail.com"},"maintainers":[{"name":"colorhook","email":"colorhook@gmail.com"}],"bugs":{"email":"colorhook@gmail.com","url":"http://github.com/colorhook/fileutil/issues"},"dependencies":{"wrench":"~1.4.4"},"homepage":"https://github.com/colorhook/fileutil","repository":{"type":"git","url":"git://github.com/colorhook/fileutil.git"},"licenses":[{"type":"MIT","url":"http://github.com/colorhook/fileutil/blob/master/LICENSE"}],"_id":"fileutil@1.0.0","dist":{"shasum":"9b00962dc1afa692ea88cfe840fa6df0c905bb74","size":6526,"noattachment":false,"key":"/fileutil/-/fileutil-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/fileutil/download/fileutil-1.0.0.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"colorhook","email":"colorhook@gmail.com"},"directories":{},"publish_time":1354774960398,"_cnpm_publish_time":1354774960398,"_hasShrinkwrap":false}},"readme":"fileutil\r\n=====\r\n\r\n目标\r\n-------\r\n简易的文件操作API\r\n\r\n安装\r\n-------\r\nnpm install fileutil\r\n\r\n示例\r\n-------\r\n\r\n```javascript\r\nvar fu = require('fileutil');\r\n\r\n//创建文件\r\nfu.touch('/var/www/log/2012-12-6.log');\r\n\r\n//创建文件夹\r\nfu.mkdri('/usr/local/tmp/node-example');\r\n\r\n//删除文件或文件夹\r\nfu.delete('/var/www/tmp');\r\n\r\n//是否存在\r\nfu.exist(file); \r\n\r\n//复制文件或者文件夹里的所有文件到某个新目录\r\nfu.copy(file, 'new-path'); \r\n\r\n//移动文件或者文件夹里的所有文件到某个新目录\r\nfu.move(file, 'new-path'); \r\n\r\n//重命名\r\nfu.rename(file, 'new-name');\r\n\r\n//列出文件夹里的所有文件和文件夹\r\nvar files = fu.list(src);\r\n\r\n//根据过滤参数，列出文件夹里的所有文件和文件夹\r\nvar files = fu.list(src, {\r\n  excludeDirectory: true, //不包含文件夹\r\n  excludeFile: false, //包含文件\r\n  matchFunction: function(item){\r\n    return item.name.match(reg);\r\n  }\r\n});\r\n\r\n//回调的方式遍历文件\r\nfu.each(src, function(item){\r\n  console.log(item.filename); //文件名\r\n  console.log(item.name); //路径\r\n  console.log(item.directory); //是否是文件夹\r\n});\r\n\r\n//异步回调的方式遍历文件\r\nfu.each(src, function(item){\r\n  console.log(item);\r\n}, {\r\n  sync: false, //异步\r\n  matchFunction: function(item){\r\n    return item.name.match(reg);\r\n  }\r\n}, function(){\r\n  console.log('遍历完成');\r\n});\r\n```\r\n\r\n\r\nLicence\r\n---------\r\n\r\n`fileutil` is free to use under MIT license. \r\n\r\nBugs & Feedback\r\n----------\r\n\r\nPlease feel free to [report bugs](http://github.com/colorhook/fileutil/issues) or [feature requests](http://github.com/colorhook/fileutil/pulls).\r\nYou can send me private message on `github`, or send me an email to: [colorhook@gmail.com]","_attachments":{},"homepage":"https://github.com/colorhook/fileutil","bugs":{"email":"colorhook@gmail.com","url":"http://github.com/colorhook/fileutil/issues"}}