Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/honzahommer/node-fs-mktemp

`mktemp` command for Node.js
https://github.com/honzahommer/node-fs-mktemp

Last synced: about 2 months ago
JSON representation

`mktemp` command for Node.js

Awesome Lists containing this project

README

        

# fs-mktemp

[![npm Package](https://img.shields.io/npm/v/fs-mktemp.svg)](https://www.npmjs.org/package/fs-mktemp)
[![License](https://img.shields.io/npm/l/express.svg)](https://github.com/honzahommer/node-fs-mktemp/blob/master/LICENSE)
[![build status](https://img.shields.io/travis/honzahommer/node-fs-mktemp/master.svg)](http://travis-ci.org/honzahommer/node-fs-mktemp)
[![downloads per month](http://img.shields.io/npm/dm/fs-mktemp.svg)](https://www.npmjs.org/package/fs-mktemp) [![Greenkeeper badge](https://badges.greenkeeper.io/honzahommer/node-fs-mktemp.svg)](https://greenkeeper.io/)

> `mktemp` command for Node.js

## Installation
> npm install fs-mktemp

## Usage

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

- `prefix` ``
- `callback` ``

#### Example

```js
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` ``

#### Example

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

console.log(mktempDirSync());
```

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

- `options` ``
- `options.content` ``
- `options.prefix` ``
- `callback` ``

*- or -*

- `prefix` ``
- `callback` ``

#### Example

```js
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` ``
- `options.content` ``
- `options.prefix` ``

*- or -*

- `prefix` ``

#### Example

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

console.log(mktempFileSync());
```