paulmillr / readdirp

Recursive version of fs.readdir with streaming api.
https://paulmillr.com
MIT License
378 stars 51 forks source link

Skip with warn for circular symlinks #169

Closed ath0mas closed 3 years ago

ath0mas commented 3 years ago

Skip with warn for circular symlinks, instead of exit with error.

Fix #168

paulmillr commented 3 years ago

Why does this require a change to warn? Can't you just handle error instead?

ath0mas commented 3 years ago

Current error means _onError will call destroy and abort the stream.

no more entries, warning or errors are emitted

while my use case is to skip and let the stream continue flowing. Also, thrown error does not have a code to match it properly.

With this PR it emits a warn event, and indeed with given code someone can use it to abort or not.

// Optionally call stream.destroy() in `warn()` ...