blob: 4ca4d7c22e74b5e2809309e49c81aa04e09696f9 [file] [log] [blame]
{
"name": "walkdir",
"description": "Find files simply. Walks a directory tree emitting events based on what it finds. Presents a familliar callback/emitter/a+sync interface. Walk a tree of any depth.",
"version": "0.0.7",
"author": {
"name": "Ryan Day",
"email": "soldair@gmail.com"
},
"keywords": [
"find",
"walk",
"tree",
"files",
"fs"
],
"main": "./walkdir.js",
"homepage": "http://github.com/soldair/node-walkdir",
"repository": {
"type": "git",
"url": "git://github.com/soldair/node-walkdir.git"
},
"scripts": {
"test": "./test.sh"
},
"devDependencies": {
"tap": "*",
"jshint": "0.5.x"
},
"engines": {
"node": ">=0.6.0"
},
"license": "MIT/X11",
"contributors": [
{
"name": "tjfontaine"
}
],
"readme": "[![Build Status](https://secure.travis-ci.org/soldair/node-walkdir.png)](http://travis-ci.org/soldair/node-walkdir)\n \n## walkdir\n\nFind files. Walks a directory tree emitting events based on what it finds. Presents a familliar callback/emitter/sync interface. Walk a tree of any depth. This is a performant option any pull requests to make it more so will be talken into consderation.. \n\n## Example\n\n```js\n\nvar walk = require('walkdir');\n\n//async with path callback \n\nwalk('../',function(path,stat){\n console.log('found: ',path);\n});\n\n//use async emitter to capture more events\n\nvar emitter = walk('../');\n\nemitter.on('file',function(filename,stat){\n console.log('file from emitter: ', filename);\n});\n\n\n//sync with callback\n\nwalk.sync('../',function(path,stat){\n console.log('found sync:',path);\n});\n\n//sync just need paths\n\nvar paths = walk.sync('../');\nconsole.log('found paths sync: ',paths);\n\n```\n\n\n## install\n\n\tnpm install walkdir\n\n## arguments\n\nwalkdir(path, [options], [callback])\nwalkdir.sync(path, [options], [callback]);\n\n- path\n - the starting point of your directory walk\n\n- options. supported options are\n - general\n\n\t```js\n\t{\n\t\"follow_symlinks\":false, // default is off \n\t\"no_recurse\":false, // only recurse one level deep\n\t\"max_depth\":undefined // only recurse down to max_depth. if you need more than no_recurse\n\t}\n\t```\n\n - sync only\n\n\t```js\n\t{\n\t\"return_object\":false, // if true the sync return will be in {path:stat} format instead of [path,path,...]\n\t\"no_return\":false, // if true null will be returned and no array or object will be created with found paths. useful for large listings\n\t}\n\t```\n\n- callback\n - this is bound to the path event of the emitter. its optional in all cases.\n\n\t```js\n\tcallback(path,stat)\n\t```\n\n## events\n\nnon error type events are emitted with (path,stat). stat is an instanceof fs.Stats\n\n###path\nfired for everything\n\n###file\nfired only for regular files\n\n###directory\nfired only for directories\n\n###link\nfired when a symbolic link is found\n\n###end\nfired when the entire tree has been read and emitted.\n\n###socket\nfired when a socket descriptor is found\n\n###fifo\nfired when a fifo is found\n\n###characterdevice\nfired when a character device is found\n\n###blockdevice\nfired when a block device is found\n\n###targetdirectory\nfired for the stat of the path you provided as the first argument. is is only fired if it is a directory.\n\n###empty\nfired for empty directory\n\n## error events\nerror type events are emitted with (path,error). error being the error object returned from an fs call or other opperation.\n\n###error\nif the target path cannot be read an error event is emitted. this is the only failure case.\n\n###fail\nwhen stat or read fails on a path somewhere in the walk and it is not your target path you get a fail event instead of error.\nThis is handy if you want to find places you dont have access too.\n\n## notes\nthe async emitter returned supports 3 methods\n\n###end\n stop a walk in progress\n\n###pause\n pause the walk. no more events will be emitted until resume\n\n###resume\n resume the walk\n\n### cancel a walk in progress\n ```js\n //cancel a walk in progress within callback.\n\n var walk = require('walkdir');\n walk('../',function(path,stat){\n this.end();\n });\n\n //cancel a walk in progress with emitter handle\n var walk = require('walkdir');\n var emitter = walk('../');\n\n doSomethingAsync(function(){\n\temitter.end();\n })\n ```\n\n## thanks\nthanks to substack. the interface for this module is based off of node-findit\n\n",
"readmeFilename": "readme.md",
"bugs": {
"url": "https://github.com/soldair/node-walkdir/issues"
},
"_id": "walkdir@0.0.7",
"_from": "walkdir@>= 0.0.1"
}