Code Monkey home page Code Monkey logo

mkdir-recursive's Introduction

NPM version Linux Status Windows Status Dependency Status Coveralls

make/remove (asynchronous/synchronous) directories recursively

Installation

Install through NPM

npm install mkdir-recursive

or

git clone git://github.com/hex7c0/mkdir-recursive.git

API

make 3 directories asynchronous recursively

var fx = require('mkdir-recursive');

fx.mkdir('foo/bar/1', function(err) {

  console.log('done');
});

mkdir(path [, mode], callback) Node Doc

  • path - String Dir pathname (default "required")
  • [mode]- Number Scrivi (default "0777")
  • callback - Function Next callback when task is complete (default "required")

mkdirSync(path [, mode]) Node Doc

  • path - String Dir pathname (default "required")
  • [mode]- Number Scrivi (default "0777")

rmdir(path, callback) Node Doc

  • path - String Dir pathname (default "required")
  • callback - Function Next callback when task is complete (default "required")

rmdirSync(path) Node Doc

  • path - String Dir pathname (default "required")

Examples

Take a look at my examples

mkdir-recursive's People

Contributors

hex7c0 avatar rdev5 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

olekenneth rdev5

mkdir-recursive's Issues

Not work on Windows 7

I use mkdirSync on Windows 7, this error happen: Error: ENOENT: no such file or directory

Drive letter lost

Running under windows, CWD is somewhere on drive X:.... , mkdirSync() called with a path with another drive as absolute, C:\a\b\c , drive letter 'C' is stripped as 'path.isAbsolute(root)' is true, the path is attempted to be made at X:\a\b\c which is wrong, it should have been C:\a\b\c .

In brief,
CWD = 'X:\d\e\f'
mkdirSync('C:\a\b\c')

Failed as path is changed to 'X:\a\b\c' .

Option `{ recursive: true }` has the opposite effect in mkdirSync

Reproduce:

const fs = require('fs');
const fx = require('mkdir-recursive');

const path = 'foo/bar/1';
console.log(fs.existsSync(path));
// fx.mkdirSync(path);
fx.mkdirSync(path, { recursive: true });
console.log(fs.existsSync('foo/'));
console.log(fs.existsSync(path));

Expected:

false
true
true

Actual:

false
true
false

Work-around:
Leave out the { recursive: true } option.

Note that this only affects mkdirSync, not mkdir.

has no method 'isAbsolute'

FsX.mkdirSync('static/uploads/avatar');

/node_modules/mkdir-recursive/index.js:72
if (path.isAbsolute(root) === true) {
^
TypeError: Object # has no method 'isAbsolute'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.