Comparing version 2.1.1 to 3.0.0
@@ -0,1 +1,7 @@ | ||
3.0.0 / 2018-08-01 | ||
------------------ | ||
- **BREAKING:** Follow symlinks by default (use the new `preserveSymlinks` option to get the old behavior) [#29](https://github.com/jprichardson/node-klaw/pull/29) | ||
- **BREAKING:** Drop Node v4 support | ||
2.1.1 / 2017-11-18 | ||
@@ -2,0 +8,0 @@ ------------------ |
{ | ||
"name": "klaw", | ||
"version": "2.1.1", | ||
"version": "3.0.0", | ||
"description": "File system walker with Readable stream interface.", | ||
@@ -35,7 +35,7 @@ "main": "./src/index.js", | ||
"rimraf": "^2.4.3", | ||
"standard": "^10.0.2", | ||
"standard": "^11.0.1", | ||
"standard-markdown": "^4.0.1", | ||
"tap-spec": "^4.1.1", | ||
"tap-spec": "^5.0.0", | ||
"tape": "^4.2.2" | ||
} | ||
} |
@@ -52,2 +52,3 @@ Node.js - klaw | ||
- `depthLimit` (`number`, default: `undefined`): The number of times to recurse before stopping. -1 for unlimited. | ||
- `preserveSymlinks` (`boolean`, default: `false`): Whether symlinks should be followed or treated as items themselves. If true, symlinks will be returned as items in their own right. If false, the linked item will be returned and potentially recursed into, in its stead. | ||
@@ -54,0 +55,0 @@ **Streams 1 (push) example:** |
@@ -9,3 +9,9 @@ var assert = require('assert') | ||
var defaultStreamOptions = { objectMode: true } | ||
var defaultOpts = { queueMethod: 'shift', pathSorter: undefined, filter: undefined, depthLimit: undefined } | ||
var defaultOpts = { | ||
queueMethod: 'shift', | ||
pathSorter: undefined, | ||
filter: undefined, | ||
depthLimit: undefined, | ||
preserveSymlinks: false | ||
} | ||
options = Object.assign(defaultOpts, options, defaultStreamOptions) | ||
@@ -27,3 +33,5 @@ | ||
self.fs.lstat(pathItem, function (err, stats) { | ||
var statFunction = this.options.preserveSymlinks ? self.fs.lstat : self.fs.stat | ||
statFunction(pathItem, function (err, stats) { | ||
var item = { path: pathItem, stats: stats } | ||
@@ -30,0 +38,0 @@ if (err) return self.emit('error', err, item) |
13481
53
254
5