You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems that the path is added to solve a problem with recursive: true: #31530.
And since only one folder will be made without recursive: true, returning path does not provide more information.
I do agree we can return path to make it more consistent though.
No one has explicitly said it so far but the ask is to change the callback in fs.mkdir(loc, (err, path) => { /* ... */}) so that path is always a string, never undefined?
That's a backwards incompatible change from the documented behavior (i.e., likely to break existing code) and we don't usually make those unless the benefits clearly outweigh the drawbacks.
Being a little more compatible with a third-party module isn't a compelling enough reason.
Activity
evenstensberg commentedon Mar 2, 2023
I'd like to fix this if you can point me to the correct code
jakecastelli commentedon Mar 3, 2023
Hi @evenstensberg do you have a code snippet to demonstrate that it is returning
undefined? cheersjakecastelli commentedon Mar 3, 2023
I can see from the doc, it explicitly mentioned that
I think there might be a reason for this behaviour, I'd suggest you wait a little bit until we can hear from the node/fs team or other maintainers.
reference: lib/fs, c++ binding
meixg commentedon Mar 3, 2023
Related to #43015
meixg commentedon Mar 3, 2023
Seems that the path is added to solve a problem with
recursive: true: #31530.And since only one folder will be made without
recursive: true, returningpathdoes not provide more information.I do agree we can return
pathto make it more consistent though.bnoordhuis commentedon Mar 4, 2023
No one has explicitly said it so far but the ask is to change the callback in
fs.mkdir(loc, (err, path) => { /* ... */})so thatpathis always a string, never undefined?That's a backwards incompatible change from the documented behavior (i.e., likely to break existing code) and we don't usually make those unless the benefits clearly outweigh the drawbacks.
Being a little more compatible with a third-party module isn't a compelling enough reason.
bnoordhuis commentedon Mar 7, 2023
Since no one chimed in after my last comment I'm going to close this but let me know if there is reason to reopen.