jprichardson / node-klaw

A Node.js file system walker with a Readable stream interface. Extracted from fs-extra.
MIT License
317 stars 41 forks source link

example of 'skip directories' does not actually skip the directories #7

Closed GuyMograbi closed 8 years ago

GuyMograbi commented 8 years ago

I am looking for a way to skip directories.

meaning - do not walk a specific directory's files or subfolders

The example in the main page does not skip folder, it simply filters out files. I'd expect it to only give the files under the current folder.

so if I have

+ root 
+------- some-dir 
                 +----------some-file.txt
+------ another-file.txt

to output only another-file.txt and some-dir is skipped.. however, I see some-file.txt is also added to items.

is there a way to actually skip a directory?

I tried not calling next(), but that seems to stop the entire process.

jprichardson commented 8 years ago

Yes, there use to, but I erroneously removed it: https://github.com/jprichardson/node-klaw/commit/35fb04a6855e820d0624ba27d0cec475b49b4696 I'd accept a PR to bring it back, but if you do, please add some tests.

ericbiewener commented 7 years ago

Wondering if this should be reopened given the issue with filter reported in https://github.com/jprichardson/node-klaw/issues/17