Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mkpath

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mkpath - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

run_linters.sh

18

mkpath.js

@@ -6,3 +6,3 @@ var fs = require('fs');

dirpath = path.resolve(dirpath);
if (typeof mode === 'function' || typeof mode === 'undefined') {

@@ -12,7 +12,7 @@ callback = mode;

}
if (!callback) {
callback = function () {};
}
fs.stat(dirpath, function (err, stats) {

@@ -25,3 +25,9 @@ if (err) {

} else {
fs.mkdir(dirpath, mode, callback);
fs.mkdir(dirpath, mode, function (err) {
if (!err || err.code == 'EEXIST') {
callback(null);
} else {
callback(err);
}
});
}

@@ -42,7 +48,7 @@ });

dirpath = path.resolve(dirpath);
if (typeof mode === 'undefined') {
mode = 0777 & (~process.umask());
}
try {

@@ -49,0 +55,0 @@ if (!fs.statSync(dirpath).isDirectory()) {

{
"name": "mkpath",
"version": "0.1.0",
"version": "1.0.0",
"author": "Jonathan Rajavuori <jrajav@gmail.com>",

@@ -19,3 +19,3 @@ "description": "Make all directories in a path, like mkdir -p",

"scripts": {
"test": "node node_modules/tap/bin/tap.js ./test"
"test": "node node_modules/tap/bin/tap.js ./test/*.js"
},

@@ -22,0 +22,0 @@ "devDependencies": {

@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp

var mkpath = require('../');
var path = require('path');
var fs = require('fs');

@@ -8,0 +7,0 @@ var test = require('tap').test;

@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp

var mkpath = require('../');
var path = require('path');
var fs = require('fs');

@@ -8,0 +7,0 @@ var test = require('tap').test;

@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp

var mkpath = require('../');
var path = require('path');
var fs = require('fs');

@@ -20,12 +19,9 @@ var test = require('tap').test;

if (err) t.fail(err);
else path.exists(file, function (ex) {
if (!ex) t.fail('file not created')
else fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.equal(stat.mode & 0777, 0755);
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
})
else fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.equal(stat.mode & 0777, 0755);
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
})

@@ -32,0 +28,0 @@ });

@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp

var mkpath = require('../');
var path = require('path');
var fs = require('fs');

@@ -15,13 +14,10 @@ var test = require('tap').test;

mkpath.sync(file, 0755);
path.exists(file, function (ex) {
if (!ex) t.fail('file not created')
else fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.equal(stat.mode & 0777, 0755);
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
})
});
fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.equal(stat.mode & 0777, 0755);
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
})
});

@@ -34,13 +30,10 @@

mkpath.sync(file, 0755);
path.exists(file, function (ex) {
if (!ex) t.fail('file not created')
else fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
})
});
fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
})
});

@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp

var mkpath = require('../');
var path = require('path');
var fs = require('fs');

@@ -16,12 +15,9 @@ var test = require('tap').test;

if (err) t.fail(err);
else path.exists(file, function (ex) {
if (!ex) t.fail('file not created')
else fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.equal(stat.mode & 0777, 0755);
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
})
else fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.equal(stat.mode & 0777, 0755);
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
})

@@ -28,0 +24,0 @@ });

@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp

var mkpath = require('../');
var path = require('path');
var fs = require('fs');

@@ -23,13 +22,10 @@ var test = require('tap').test;

if (err) t.fail(err);
else path.exists(file, function (ex) {
if (!ex) t.fail('file not created')
else fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
process.chdir(cwd);
t.equal(stat.mode & 0777, 0755);
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
})
else fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
process.chdir(cwd);
t.equal(stat.mode & 0777, 0755);
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
})

@@ -36,0 +32,0 @@ });

@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp

var mkpath = require('../');
var path = require('path');
var fs = require('fs');

@@ -25,14 +24,11 @@ var test = require('tap').test;

path.exists(file, function (ex) {
if (!ex) t.fail('file not created')
else fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.equal(stat.mode & 0777, 0755);
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
});
fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.equal(stat.mode & 0777, 0755);
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
});
});

@@ -5,3 +5,2 @@ /* Tests borrowed from substack's node-mkdirp

var mkpath = require('../');
var path = require('path');
var fs = require('fs');

@@ -25,14 +24,11 @@ var test = require('tap').test;

path.exists(file, function (ex) {
if (!ex) t.fail('file not created')
else fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.equal(stat.mode & 0777, (0777 & (~process.umask())));
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
});
fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.equal(stat.mode & 0777, (0777 & (~process.umask())));
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
});
});

@@ -19,12 +19,9 @@ /* Tests borrowed from substack's node-mkdirp

if (err) t.fail(err);
else path.exists(file, function (ex) {
if (!ex) t.fail('file not created')
else fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.equal(stat.mode & 0777, 0777 & (~process.umask()));
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
})
else fs.stat(file, function (err, stat) {
if (err) t.fail(err)
else {
t.equal(stat.mode & 0777, 0777 & (~process.umask()));
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}
})

@@ -31,0 +28,0 @@ });

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc