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

mkdirp2

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mkdirp2 - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

index.js

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

mkdirP.promise = function (p, opts) {
return new Promise((resolve, reject) => {
return new Promise(function (resolve, reject) {
mkdirP(p, opts, function (err) {

@@ -101,0 +101,0 @@ if (err) {

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

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

"devDependencies": {
"mock-fs": "^4.3.0",
"tap": "^10.3.2"
"mock-fs": "^3.12.1",
"tap": "^5.8.0"
},
"license": "MIT"
}

@@ -11,8 +11,11 @@ [![view on npm](http://img.shields.io/npm/v/mkdirp2.svg)](https://www.npmjs.org/package/mkdirp2)

Extended with a promise method:
## Differences
```js
mkdirp.promise('/tmp/tmp2/file')
.then(() => console.log('Created'))
.catch(err => console.error(`Failed: ${err.message}`))
```
1. Command-line executable and its dependencies removed, this fork is for Nodejs use only.
2. Extended with a promise method:
```js
mkdirp.promise('tmp/tmp2/file')
.then(() => console.log('Created'))
.catch(err => console.error(`Failed: ${err.message}`))
```

@@ -9,24 +9,26 @@ var mkdirp = require('../')

test('woo-promise', function (t) {
t.plan(4)
var x = Math.floor(Math.random() * Math.pow(16, 4)).toString(16)
var y = Math.floor(Math.random() * Math.pow(16, 4)).toString(16)
var z = Math.floor(Math.random() * Math.pow(16, 4)).toString(16)
if (typeof Promise !== 'undefined') {
test('woo-promise', function (t) {
t.plan(4)
var x = Math.floor(Math.random() * Math.pow(16, 4)).toString(16)
var y = Math.floor(Math.random() * Math.pow(16, 4)).toString(16)
var z = Math.floor(Math.random() * Math.pow(16, 4)).toString(16)
var file = '/tmp/' + [x, y, z].join('/')
var file = '/tmp/' + [x, y, z].join('/')
mkdirp.promise(file, _0755)
.catch(function (err) {
t.fail(err)
})
.then(function () {
exists(file, function (ex) {
t.ok(ex, 'file created')
fs.stat(file, function (err, stat) {
t.ifError(err)
t.equal(stat.mode & _0777, _0755)
t.ok(stat.isDirectory(), 'target not a directory')
mkdirp.promise(file, _0755)
.catch(function (err) {
t.fail(err)
})
.then(function () {
exists(file, function (ex) {
t.ok(ex, 'file created')
fs.stat(file, function (err, stat) {
t.ifError(err)
t.equal(stat.mode & _0777, _0755)
t.ok(stat.isDirectory(), 'target not a directory')
})
})
})
})
})
})
}

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