JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 635601
  • Score
    100M100P100Q178249F
  • License MIT

mktemp command for node.js

Package Exports

  • mktemp

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (mktemp) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

mktemp

Build Status Dependency Status

mktemp command for node.js

Installation

$ npm install mktemp

Usage

var mktemp = require('mktemp');

mktemp.createFile('file-XXXXXX', function(err, path) {
  if (err) throw err;
  console.log(path);  // match to /^file-[\da-zA-Z]{6}$/
});

mktemp.createFileSync('file-XXX');
// return value is match to /^file-[\da-zA-Z]{3}$/

mktemp.createDir('dir-XXXXX', function(err, path) {
  if (err) throw err;
  console.log(path);  // match to /^dir-[\da-zA-Z]{5}$/
});

mktemp.createDirSync('dir-XXX');
// return value is match to /^dir-[\da-zA-Z]{3}$/

mktemp functions replace to unique name from "X" at near end of line.

'XXXXXXXXXXX'  // /^[\da-zA-Z]{11}$/
'abc-XXXXXXX'  // /^abc-[\da-zA-Z]{7}$/
'XXX-XXXXXXX'  // /^XXX-[\da-zA-Z]{7}$/
'XXX-XXX.tmp'  // /^XXX-[\da-zA-Z]{3}\.tmp$/

Functions

createFile(template, callback)

  • template string - filename template
  • callback function(err, path) - callback function
    • err - error object
    • path - replaced path

create blank file of unique filename. permission is 0600.

createFileSync(template)

  • template string - filename template
  • return string - replaced path

sync version createFile.

createDir(template, callback)

  • template string - dirname template
  • callback function(err, path) - callback function
    • err - error object
    • path - replaced path

create directory of unique dirname. permission is 0700.

createDirSync(template)

  • template string - dirname template
  • return string - replaced path

sync version createDir.

Test

$ npm install
$ npm test

Contributors

License

The MIT license. Please see LICENSE file.