mktemp

WebJar for mktemp

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

mktemp
Последняя версия

Последняя версия

0.4.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

mktemp
WebJar for mktemp
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/sasaplus1/mktemp

Скачать mktemp

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/mktemp/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>mktemp</artifactId>
    <version>0.4.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/mktemp/
implementation 'org.webjars.npm:mktemp:0.4.0'
// https://jarcasting.com/artifacts/org.webjars.npm/mktemp/
implementation ("org.webjars.npm:mktemp:0.4.0")
'org.webjars.npm:mktemp:jar:0.4.0'
<dependency org="org.webjars.npm" name="mktemp" rev="0.4.0">
  <artifact name="mktemp" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='mktemp', version='0.4.0')
)
libraryDependencies += "org.webjars.npm" % "mktemp" % "0.4.0"
[org.webjars.npm/mktemp "0.4.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

mktemp

Build Status npm version Try mktemp on RunKit renovate

mktemp command for node.js

Installation

$ npm install mktemp

Usage

var mktemp = require('mktemp');

mktemp.createFile('XXXXX.txt', function(err, path) {
  if (err) throw err;

  // path match a /^[\da-zA-Z]{5}\.txt$/
  console.log(path);
});

// return value match a /^[\da-zA-Z]{5}\.tmp$/
mktemp.createFileSync('XXXXX.tmp');

mktemp.createDir('XXXXXXX', function(err, path) {
  if (err) throw err;

  // path match a /^[\da-zA-Z]{7}$/
  console.log(path);
});

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

if support Promise, can use Promise style.

var mktemp = require('mktemp');

mktemp
  .createFile('XXXXX.txt')
  .then(function(path) {
    // path match a /^[\da-zA-Z]{5}\.txt$/
    console.log(path);
  })
  .catch(function(err) {
    console.error(err);
  });

mktemp
  .createDir('XXXXX')
  .then(function(path) {
    // path match a /^[\da-zA-Z]{5}$/
    console.log(path);
  })
  .catch(function(err) {
    console.error(err);
  });

mktemp functions are replace to random string from placeholder "X" in template. see example:

mktemp.createFileSync('XXXXXXX');  // match a /^[\da-zA-Z]{7}$/
mktemp.createFileSync('XXX.tmp');  // match a /^[\da-zA-Z]{3}\.tmp$/
mktemp.createFileSync('XXX-XXX');  // match a /^XXX-[\da-zA-Z]{3}$/

Functions

createFile(template[, callback])

  • template
    • String - filename template
  • callback
    • function(err, path) - callback function
      • err : Error|Null - error object
      • path : String - path

create blank file of unique filename. permission is 0600.

it throws TypeError if node.js unsupported Promise and callback is not a function.

createFileSync(template)

  • template
    • String - filename template
  • return
    • String - path

sync version createFile.

createDir(template[, callback])

  • template
    • String - dirname template
  • callback
    • function(err, path) - callback function
      • err : Error|Null - error object
      • path : String - path

create directory of unique dirname. permission is 0700.

it throws TypeError if node.js unsupported Promise and callback is not a function.

createDirSync(template)

  • template
    • String - dirname template
  • return
    • String - path

sync version createDir.

Contributors

License

The MIT license.

Версии библиотеки

Версия
0.4.0