-
Notifications
You must be signed in to change notification settings - Fork 774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance walkSync() to return items with path and stats #312
Conversation
} else { | ||
filelist.push(nestedPath) | ||
list.push({path: nestedPath, stats: assign({}, {type: 'file'}, stat)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the type
field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I forgot to tell you that I added that just to make it more distinct. If you think that's unnecessary, I remove it right away.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I remove it then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I remove it then?
Yea, as it doesn't match fs.walk()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure. I'll send you another PR, then. Thanks @jprichardson. I really appreciate your support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, the current version of walkSync
doesn't catch the fs.readdirSync()
and fs.lstatSync()
errors if any been thrown. What do you think about wrapping the function in a try/catch
block and throw the error if any occurred?
Edit:
Since it is clearly mentioned in the docs that the Sync
version of the functions throws the errors, I think we can ignore catching errors here since fs
will throw them anyway. Right?
@jprichardson Can you manually restart the appveyor build? |
I wonder why it's failing here... I think a push has to trigger it... |
@jprichardson I think it migh be related to isaacs/node-graceful-fs#98. |
@mawni Can you rebase onto |
@jprichardson Are the changes introduced here merge-ready? If so, I will cherry-pick this to |
@mawni will you squash these? |
@RyanZim for now, I've created a branch https://github.com/jprichardson/node-fs-extra/tree/1.x in case we need to publish any hotfixes. |
@mawni thanks! Will be published in early Jan. |
@jprichardson This needs to be documented sometime before the release; however, we don't really want incorrect docs on |
I think we should have a |
@jprichardson If you want As far as branching, I prefer Since this is already merged, how about changing |
I like this. It's what I do for private bigger projects.
I'm okay with this, do you mind spearheading it? |
@jprichardson Only the owner can change the default branch, so you'll have to do that. As far as v2, I'll try to shoot you an email when I get a chance. |
done! |
Hi,
This PR is regarding #310. I modified
walkSync
and its test to return an array of items{path:,stats:}
to be consistent withwalk
. Please let me know what you think. I appreciate it in advance. Thanks a lot.