Skip to content

Commit 2389ab0

Browse files
committed
update readme and changelog
1 parent 56d1828 commit 2389ab0

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@
2929

3030
- initial release
3131

32+
[#1]: https://github.com/manidlou/node-klaw-sync/issues/1 "loading all files with certain name"
33+

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Usage
2323
- `options` `<Object>` *optional* (all options are `false` by default)
2424
- `nodir` `<Boolean>` return only files (ignore directories)
2525
- `nofile` `<Boolean>` return only directories (ignore files)
26-
- `noRecurseOnFilter` `<Boolean>` the default behavior is to read all directories even though they don't pass the `filter` function (won't be included but still will be traversed). Set `true` to prevent unnecessary traversal of unwanted directories
26+
- `noRecurseOnFilter` `<Boolean>` when `filter` function is used, the default behavior is to read all directories even though they don't pass the `filter` function (won't be included but still will be traversed). Set `true` to prevent unnecessary traversal of unwanted directories
2727
- `filter` `<Function>` function that gets one argument `fn({path: '', stats: {}})` and returns true to include or false to exclude the item
2828

2929
- return: `<Array<Object>>` `[{path: '', stats: {}}]`
@@ -33,6 +33,7 @@ Examples
3333

3434
```js
3535
const klawSync = require('klaw-sync')
36+
3637
const paths = klawSync('/some/dir')
3738
// paths = [{path: '/some/dir/dir1', stats: {}}, {path: '/some/dir/file1', stats: {}}]
3839
```
@@ -55,6 +56,7 @@ _**files only**_
5556

5657
```js
5758
const klawSync = require('klaw-sync')
59+
5860
const files = klawSync('/some/dir', {nodir: true})
5961
// files = [{path: '/some/dir/file1', stats: {}}, {path: '/some/dir/file2', stats: {}}]
6062
```
@@ -63,6 +65,7 @@ _**directories only**_
6365

6466
```js
6567
const klawSync = require('klaw-sync')
68+
6669
const dirs = klawSync('/some/dir', {nofile: true})
6770
// dirs = [{path: '/some/dir/dir1', stats: {}}, {path: '/some/dir/dir2', stats: {}}]
6871
```
@@ -107,8 +110,8 @@ Again here `noRecurseOnFilter` is not required since we still want to read all d
107110
const klawSync = require('klaw-sync')
108111

109112
const refTime = new Date(2017, 3, 24).getTime()
113+
const filterFn = item => item.stats.mtime.getTime() > refTime
110114

111-
const filterFn = item => item.stats.mtime > refTime
112115
const paths = klawSync('/some/dir', { filter: filterFn })
113116
```
114117

@@ -131,7 +134,7 @@ The `bm.js` runs some basic [benchmark](https://github.com/bestiejs/benchmark.js
131134
- [walk-sync](https://github.com/joliss/node-walk-sync)
132135
- [glob.sync](https://github.com/isaacs/node-glob#globsyncpattern-options)
133136

134-
Just for fun, it turned out (as of January 25, 2017) for the most cases `klaw-sync` is faster than other modules!
137+
It turned out (as of January 25, 2017) for the most cases `klaw-sync` is faster than other modules!
135138

136139
##### run benchmark
137140

0 commit comments

Comments
 (0)