ensure-path

0.0.1 • Public • Published

Ensure-path

What does this do?

If you use fs.mkdir('./foo/bar',callback),it will throws error if foo does not exist or bar already esists.

ensure-path make a simple and safe way to cerate a dir or file.

How to use?

npm i ensure-path --save

const {ensureDirSync, ensureFileSync} = require('ensure-path')
 
 //ensure there have a dir
 ensureDirSync('./foo/bar')
 
 //ensure there hava a file
 ensureFileSync('./hello/world.txt')
 // if file already exists, it will keep file abiding

notice

you need use super user to create dir or file on root dir.

Readme

Keywords

none

Package Sidebar

Install

npm i ensure-path

Weekly Downloads

1

Version

0.0.1

License

none

Unpacked Size

3.6 kB

Total Files

11

Last publish

Collaborators

  • saltfish666