mktemp
mktemp command for node.js
Installation
$ npm install mktemp
Usage
var mktemp = ; mktemp; // return value match a /^[\da-zA-Z]{5}\.tmp$/mktemp; mktemp; // return value match a /^XXX-[\da-zA-Z]{3}$/mktemp;
mktemp functions are replace to random string from placeholder "X" in template. see example:
mktemp; // match a /^[\da-zA-Z]{7}$/mktemp; // match a /^[\da-zA-Z]{3}\.tmp$/mktemp; // match a /^XXX-[\da-zA-Z]{3}$/
Functions
createFile(template, callback)
template
String
- filename template
callback
function(err, path)
- callback functionerr
:Error|Null
- error objectpath
:String
- path
create blank file of unique filename.
permission is 0600
.
createFileSync(template)
template
String
- filename template
return
String
- path
sync version createFile.
createDir(template, callback)
template
String
- dirname template
callback
function(err, path)
- callback functionerr
:Error|Null
- error objectpath
:String
- path
create directory of unique dirname.
permission is 0700
.
createDirSync(template)
template
String
- dirname template
return
String
- path
sync version createDir.
Test
$ npm install$ npm test
Contributors
License
The MIT license. Please see LICENSE file.