Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mktemp

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mktemp

mktemp command for node.js

  • 0.3.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
280K
decreased by-17.82%
Maintainers
1
Weekly downloads
 
Created
Source

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.

mktemp.createFileSync('XXXXXXXXXXX');  // match to /^[\da-zA-Z]{11}$/
mktemp.createFileSync('abc-XXXXXXX');  // match to /^abc-[\da-zA-Z]{7}$/
mktemp.createFileSync('XXX-XXXXXXX');  // match to /^XXX-[\da-zA-Z]{7}$/
mktemp.createFileSync('XXX-XXX.tmp');  // match to /^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.

FAQs

Package last updated on 23 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc