Skip to content

saltfish666/ensure-path

Repository files navigation

Ensure-path

Build Status codecov npm version npm JavaScript Style Guide

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.

About

ensure there have a file or dir

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published