{"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"}],"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]","_id":"fileutil@1.0.0","dist":{"shasum":"9b00962dc1afa692ea88cfe840fa6df0c905bb74","tarball":"http://registry-npm.ywwl.com/fileutil/download/fileutil-1.0.0.tgz","integrity":"sha512-BxPye/onszEVhsRpEXei9XCyWdNzscUNAmW6Aq83kicgiEeUkbFigXBgD9B2l6bMp5uZE9OzgOATZ2laKatFPA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIE24U2HNoKZxQNSSFoBRtrnU1p69VoY7KVkIXCwKjWq9AiEA/otu+86sL2BrCDE68G/qaP8rJ5/RqxOig2lXJlUd/4c="}],"size":6526,"noattachment":false,"key":"/fileutil/-/fileutil-1.0.0.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"colorhook","email":"colorhook@gmail.com"},"directories":{},"publish_time":1354774960398,"_cnpm_publish_time":1354774960398,"dist-tags":{"latest":"1.1.1"}}