ensure-file
v1.0.7
Published
Ensures that the file path exists.
Downloads
245
Maintainers
Readme
ensure-file
Ensures that the file path exists. Like fs-extra#ensureFile but out of the box.
Install
$ npm install ensure-file --save
Usage
'use strict'
var ensureFile = require('ensure-file')
var file = '/tmp/this/path/does/not/exist/file.txt'
ensureFile(file, function (err) {
console.log(err) // => null
// file has now been created, including the directory it is to be placed in
})
API
ensureFile(file, cb)
ensureFile.sync(file)
file
Required
Type: string
License
MIT © Kiko Beats