Skip to content
Browse files

fs: make mkdir() default to 0777 permissions

Fixes #1999.
  • Loading branch information...
1 parent 52eaac4 commit 11d68eb3fc3c2f8d377cf8c50f1babb8d1f82d5f @bnoordhuis committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/fs.js
4 lib/fs.js
@@ -354,11 +354,11 @@ fs.fsyncSync = function(fd) {
fs.mkdir = function(path, mode, callback) {
- binding.mkdir(path, modeNum(mode), callback || noop);
+ binding.mkdir(path, modeNum(mode, 511 /*=0777*/), callback || noop);
koichik added a note

modeNum(mode, '0777')?

@bnoordhuis Owner

As a natural born optimizer it pains me to do a superfluous parseInt(s, 8) every call...

koichik added a note

I see. Strict mode should get back OctalIntegerLiteral...

@bnoordhuis Owner

I suspect it caters to web developers who've never heard of octal in the first place, then spend days tracking down bugs caused by a stray zero.

I'd rather leave the patch as it is. LGTY?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
fs.mkdirSync = function(path, mode) {
- return binding.mkdir(path, modeNum(mode));
+ return binding.mkdir(path, modeNum(mode, 511 /*=0777*/));
fs.sendfile = function(outFd, inFd, inOffset, length, callback) {

0 comments on commit 11d68eb

Please sign in to comment.
Something went wrong with that request. Please try again.