A Node.js file system walker with a Readable stream interface. Extracted from fs-extra.
In #23, @dzek69 mentioned that klaw stops on error, and I encountered the same issue. This behavior exists because the implementation of `readable._read(size)` necessitates a call to `readable.push()` before it will be called again, and it's possible for klaw to [return from _read without calling push](https://github.com/jprichardson/node-klaw/blob/master/src/index.js#L36) when it encounters an error. When this occurs, `_read` is never called again. > [from the Stream documentation](https://nodejs.org/api/stream.html#stream_readable_read_size_1): Once the `readable._read()` method has been called, it will not be called again until the `readable.push()` method is called. I solved this problem by more closely aligning the `_read` implementation with the suggestion in the docs: > [from the Stream documentation](https://nodejs.org/api/stream.html#stream_readable_read_size_1): `_read()` should continue reading from the resource and pushing data until `readable.push()` returns `false` With this PR, `_read` will continue to iterate over paths until `push` returns false or it runs out of paths. When an error is encountered before we call `push`, it will continue processing and make subsequent calls to push if there are any eligible paths, so errors no longer terminate the crawl prematurely. Some notes: - It avoids large call stacks by using a generator instead of recursive callbacks (using async/await would have been nice here, but isn't compatible with node 6.x) - There are no tests for this new functionality, but I will add them if this PR is considered
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by dzaman and has received 2 comments.