Skip to content
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

fs: fs.mkdirs or fs.mkdirp #683

Closed
xionglun opened this issue Jan 31, 2015 · 12 comments
Closed

fs: fs.mkdirs or fs.mkdirp #683

xionglun opened this issue Jan 31, 2015 · 12 comments
Labels
fs Issues and PRs related to the fs subsystem / file system.

Comments

@xionglun
Copy link

I hope fs module can provide a method likes mkdirp.
Yes, mkdirp module is good, and much people use it or depend on it.
But, I think it should be provided at language level not library level.
Just like Java:

// Creates the directory named by this abstract pathname.
public boolean mkdir()

//Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories.
public boolean mkdirs()
@cjihrig
Copy link
Contributor

cjihrig commented Jan 31, 2015

Is there any reason this needs to be a part of core? Feature parity with Java is definitely not a reason :-)

@vkurchatkin
Copy link
Contributor

@Qard
Copy link
Member

Qard commented Jan 31, 2015

Personally, I find it a bit weird that a recursive option exists in the command line tool but not in the node.js/io.js interface. As explained in the node issue though, it has to do with the posix interface not having a recursive component to it.

It's easy enough to just depend on mkdirp though. At best, I'd say this is very low priority.

@jonathanong
Copy link
Contributor

i think it's only worth adding if it's done in the C++ layer with some sort of performance improvement. if it's written in JS, then it might as well remain a module.

@rvagg
Copy link
Member

rvagg commented Jan 31, 2015

What reasons would you need mkdirp to be optimised? Are you making nested directories for each web request or something?

I'm not convinced, mkdirp exists and is well used & liked. So -1 from me.

@othiym23
Copy link
Contributor

-1 from me as well. mkdirp is an npm install away, and even includes a command-line utility for Windows users.

@ifraixedes
Copy link

I agree with @jonathanong however @rvagg is in the point, what use case should need that level of optimization? if no use case the optimization, if there is any, shouldn't be needed, then -1, too.

@Fishrock123
Copy link
Contributor

I've always found it rather strange that recursive mkdir* isn't default. -0

@brendanashworth brendanashworth added the fs Issues and PRs related to the fs subsystem / file system. label Feb 1, 2015
@xionglun
Copy link
Author

xionglun commented Feb 1, 2015

  1. Too many people use it
    just look at mkdirp's stats:

    132,488 downloads in the last day
    1,754,521 downloads in the last week
    6,734,370 downloads in the last month

  2. It could be a fundamental method bind to core object---fs
    It will be more natural than use a plugin or an extension like mkdirp. It's not a performance issue but seems should be part of fs.

  3. Not need install every time
    As mentioned at the top, so many people rely on it. Every time i use it, have to use npm install.
    Yes, npm install works, but not always works. such as at bad networking or behind our GFW.

@rvagg
Copy link
Member

rvagg commented Feb 1, 2015

Welcome to Node, where our standard library is tiny and all of the good stuff is in npm.

Many of us will fight hard to keep it that way.

There's already a mirror behind the GFW, you should probably use that, see http://cnpmjs.org/

@xionglun
Copy link
Author

xionglun commented Feb 1, 2015

@rvagg Yes, I appreciate that principle.
But, honestly, if fs.mkdirs exists, I bet it will be more popular than other fs methods such as fs.chown, fs.chmod.
If you insist, well, that's ok.

@cjihrig cjihrig closed this as completed Feb 1, 2015
@Delapouite
Copy link
Contributor

Relevant discussion in the mkdirp repo with answers by @substack : https://github.com/substack/node-mkdirp/issues/17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system.
Projects
None yet
Development

No branches or pull requests