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

mkdirp

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mkdirp - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

.gitignore

2

index.js

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

var cb = f || function () {};
if (p.charAt(0) != '/') { cb(new Error('Relative path: ' + p)); return }
p = path.resolve(p);

@@ -9,0 +9,0 @@ var ps = path.normalize(p).split('/');

{
"name" : "mkdirp",
"description" : "Recursively mkdir, like `mkdir -p`",
"version" : "0.0.6",
"version" : "0.0.7",
"author" : "James Halliday <mail@substack.net> (http://substack.net)",

@@ -16,6 +16,6 @@ "main" : "./index",

"scripts" : {
"test" : "expresso"
"test" : "node node_modules/tap/bin/tap.js test/*.js"
},
"devDependencies" : {
"expresso" : "0.7.x"
"tap" : "0.0.x"
},

@@ -22,0 +22,0 @@ "license" : "MIT/X11",

@@ -1,7 +0,8 @@

var assert = require('assert');
var mkdirp = require('../');
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
exports.woo = function () {
test('woo', function (t) {
t.plan(2);
var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16);

@@ -12,16 +13,13 @@ var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16);

var file = '/tmp/' + [x,y,z].join('/');
var to = setTimeout(function () {
assert.fail('never called back');
}, 1000);
mkdirp(file, 0755, function (err) {
if (err) assert.fail(err);
if (err) t.fail(err);
else path.exists(file, function (ex) {
if (!ex) assert.fail('file not created')
if (!ex) t.fail('file not created')
else fs.stat(file, function (err, stat) {
if (err) assert.fail(err)
if (err) t.fail(err)
else {
clearTimeout(to);
assert.eql(stat.mode & 0777, 0755);
assert.ok(stat.isDirectory(), 'target not a directory');
t.equal(stat.mode & 0777, 0755);
t.ok(stat.isDirectory(), 'target not a directory');
t.end();
}

@@ -31,2 +29,2 @@ })

});
};
});

@@ -1,7 +0,8 @@

var assert = require('assert');
var mkdirp = require('../').mkdirp;
var path = require('path');
var fs = require('fs');
var test = require('tap').test;
exports.race = function () {
test('race', function (t) {
t.plan(4);
var ps = [ '', 'tmp' ];

@@ -14,15 +15,23 @@

var file = ps.join('/');
mk(file);
mk(file);
function mk (file) {
var res = 2;
mk(file, function () {
if (--res === 0) t.end();
});
mk(file, function () {
if (--res === 0) t.end();
});
function mk (file, cb) {
mkdirp(file, 0755, function (err) {
if (err) assert.fail(err);
if (err) t.fail(err);
else path.exists(file, function (ex) {
if (!ex) assert.fail('file not created')
if (!ex) t.fail('file not created')
else fs.stat(file, function (err, stat) {
if (err) assert.fail(err)
if (err) t.fail(err)
else {
assert.eql(stat.mode & 0777, 0755);
assert.ok(stat.isDirectory(), 'target not a directory');
t.equal(stat.mode & 0777, 0755);
t.ok(stat.isDirectory(), 'target not a directory');
if (cb) cb();
}

@@ -33,2 +42,2 @@ })

}
};
});
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