Skip to content

honzahommer/node-fs-mktemp

Repository files navigation

fs-mktemp

npm Package License build status downloads per month Greenkeeper badge

mktemp command for Node.js

Installation

npm install fs-mktemp

Usage

mktempDir([prefix='tmp'], [callback]);

  • prefix <String>
  • callback <Function>

Example

const { mktempDir } = require('fs-mktemp');

mktempDir((err, dir) => {
  if (err) {
    return console.error(err);
  }

  console.log(dir);
});

mktempDir()
  .then(dir => {
    console.log(dir);
  })
  .catch(err => {
    console.error(err);
  });

mktempDirSync([prefix='tmp'])

  • prefix <String>

Example

const { mktempDirSync } = require('fs-mktemp');

console.log(mktempDirSync());

mktempFile([options={content:'',prefix:'tmp'}|prefix='tmp'], [callback])

  • options <Object>
  • options.content <String>
  • options.prefix <String>
  • callback <Function>

- or -

  • prefix <String>
  • callback <Function>

Example

const { mktempFile } = require('fs-mktemp');

mktempFile((err, file) => {
  if (err) {
    return console.error(err);
  }

  console.log(file);
});

mktempFile()
  .then(file => {
    console.log(file);
  })
  .catch(err => {
    console.error(err);
  });

mktempFileSync([options={content:'',prefix:'tmp'}|prefix='tmp'])

  • options <Object>
  • options.content <String>
  • options.prefix <String>

- or -

  • prefix <String>

Example

const { mktempFileSync } = require('fs-mktemp');

console.log(mktempFileSync());

About

`mktemp` command for Node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published