walkdir
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -0,1 +1,11 @@ | ||
### v0.3.0 | ||
feat: added find_links option to toggle between stat and lstat. defaults to | ||
existing behavior. | ||
### v0.2.0 | ||
added new option "filter". this allows you to filter a directory listing before statting anything. | ||
the goal being to enable efficient ignore file application. | ||
documented fs option. we've had an fs option for a while so folks could provide custom fs implementations but now its documented in the readme. | ||
### v0.1.1 | ||
@@ -2,0 +12,0 @@ added missing emitter.end to typescript types and updayibng test to include custom emitter methods |
{ | ||
"name": "walkdir", | ||
"description": "Find files simply. Walks a directory tree emitting events based on what it finds. Presents a familiar callback/emitter/a+sync interface. Walk a tree of any depth.", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"author": "Ryan Day <soldair@gmail.com>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -99,3 +99,7 @@ [![Build Status](https://secure.travis-ci.org/soldair/node-walkdir.png)](http://travis-ci.org/soldair/node-walkdir) | ||
*/ | ||
"fs"?:any | ||
"fs"?:any, | ||
/*** | ||
* default True. if false this will use stat insteqad of lstat and not find links at all. | ||
*/ | ||
"find_links?":boolean, | ||
} | ||
@@ -102,0 +106,0 @@ ``` |
@@ -70,3 +70,3 @@ import { EventEmitter } from "events"; | ||
*/ | ||
"no_return"?: boolean, // if true null will be returned and no array or object will be created with found paths. useful for large listings | ||
"no_return"?: boolean, | ||
/** | ||
@@ -76,2 +76,10 @@ * filter. filter an array of paths from readdir | ||
"filter"?:(directory:string,files:string[])=>string[]|Promise<string[]>, | ||
/** | ||
* provide an alternate implementation of fs like graceful-fs | ||
*/ | ||
"fs"?:any, | ||
/*** | ||
* default True. if false this will use stat insteqad of lstat and not find links at all. | ||
*/ | ||
"find_links"?:boolean, | ||
} | ||
@@ -78,0 +86,0 @@ |
@@ -50,2 +50,5 @@ var EventEmitter = require('events').EventEmitter, | ||
options = options || {}; | ||
if(options.find_links === undefined){ | ||
options.find_links = true; | ||
} | ||
@@ -131,3 +134,3 @@ var fs = options.fs || _fs; | ||
try{ | ||
stat = fs.lstatSync(path); | ||
stat = fs[options.find_links?'lstatSync':'statSync'](path); | ||
} catch (e) { | ||
@@ -139,3 +142,3 @@ ex = e; | ||
} else { | ||
fs.lstat(path,statAction); | ||
fs[options.find_links?'lstat':'stat'](path,statAction); | ||
} | ||
@@ -142,0 +145,0 @@ },readdir = function(path,stat,depth){ |
40708
42
942
219