Node-fs-extra: Edit walkSync to return items like what walk emits

Created on 12 Nov 2016  路  12Comments  路  Source: jprichardson/node-fs-extra

What do you think about editing walkSync so that it would be consistent with walk? That is, walkSync also returns an array of items {path:, stats:} instead of only file paths, consistent with what walk emits as its data?

documentation enhancement feature-walk

Most helpful comment

Yes, I like this a lot. However, since we just released 1.0.0, this wouldn't make it until 2.0.0 since it's a breaking change. I'd like to release 2.0.0 in early 2017 when we can drop Node v0.12 support.

All 12 comments

@jprichardson ?

Sorry, I just wanted to email @jprichardson to ask for his attention regarding this issue, but I accidentally email him through that PR. Bad mistake by me. Obviously that PR is not at all related to this issue. Please accept my apologies.

Yes, I like this a lot. However, since we just released 1.0.0, this wouldn't make it until 2.0.0 since it's a breaking change. I'd like to release 2.0.0 in early 2017 when we can drop Node v0.12 support.

Absolutely. So, I will send you a PR. Then, whenever you have time, you can test it and see if it works the way that it is supposed to.

It would be great to also have directories included in the list as part of this change.

This feature should be shipped in Jan 2017.

@jprichardson Thoughts on @r-murphy's proposal?

It would be great to also have directories included in the list as part of this change.

Gah, I think this is a bug and should be there. Maybe for 1.0 we consider walkSync() broken. IDK. Maybe for 2.0 walk() and walkSync() should be removed.

I think this is a bug and should be there

Docs say:

Lists all files inside a directory recursively

I agree it's a bit unexpected though.

:+1: for redoing or removing walk* for v2. I have thought it seems a bit out-of-scope for fs-extra (not saying we couldn't use it internally for copy). Not to mention the fact that it is sort of weird to have a non-callback async method.

For walk(), if you are still willing to keep it, in order to make it consistent with other async methods, how about using klaw internally and when klaw emits end, we return a callback with an array of items {path:,stats:}?

Fixed by https://github.com/jprichardson/node-fs-extra/pull/312 on the v2 branch. Still needs docs.

@RyanZim I am preparing the docs to include the enhanced walkSync method.

@jprichardson & I have decided to remove walk and walkSync from fs-extra, at least for the time being. See https://github.com/jprichardson/node-fs-extra/issues/338 for more details. Therefore, closing this issue.

Was this page helpful?
0 / 5 - 0 ratings