# @coolgk/tmp

> wrapper functions, generate tmp file or folders

Latest version **2.0.6** (published 2019-08-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @coolgk/tmp
pnpm add @coolgk/tmp
yarn add @coolgk/tmp
bun add @coolgk/tmp
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.6 |
| Published | 2019-08-08 |
| First published | 2018-01-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 7.9 KB |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Daniel Gong |
| Maintainers | coolgk |
| Keywords | temp, tmp, typescript |

## Links

- npm: https://www.npmjs.com/package/@coolgk/tmp
- Repository: https://github.com/coolgk/node-utils
- Issues: https://github.com/coolgk/node-utils/issues
- npm.io page: https://npm.io/package/@coolgk/tmp

## Dependencies (2)

- [tmp](https://npm.io/package/tmp.md) 0.0.33
- [@types/tmp](https://npm.io/package/@types/tmp.md) 0.0.33

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.0.6 (latest) — 2019-08-08
- 2.0.5 — 2018-02-21
- 2.0.4 — 2018-01-30
- 2.0.3 — 2018-01-25
- 2.0.2 — 2018-01-25
- 2.0.1 — 2018-01-24
- 2.0.0 — 2018-01-20
- 1.1.4 — 2018-01-17
- 1.1.3 — 2018-01-17
- 1.1.2 — 2018-01-16
- 1.1.1 — 2018-01-16
- 1.1.0 — 2018-01-16
- 1.0.9 — 2018-01-14
- 1.0.8 — 2018-01-13
- 1.0.6 — 2018-01-12
- … 3 more at https://npm.io/package/@coolgk/tmp/versions

## README

## @coolgk/tmp
a javascript / typescript module

`npm install @coolgk/tmp`

wrapper functions, generate tmp file or folders

Report bugs here: [https://github.com/coolgk/node-utils/issues](https://github.com/coolgk/node-utils/issues)
## Examples
```javascript
import { generateFile, generateDir, generateTmpName } from '@coolgk/tmp';
// OR
// const { generateFile, generateDir, generateTmpName } = require('@coolgk/tmp');

generateFile({dir: '/tmp/test'}).then((r) => console.log('file', r));
    // file { path: '/tmp/test/1512307052908140480ZZj6J0LOIJb.tmp' }

generateDir({dir: '/tmp/test'}).then((r) => console.log('dir',r));
    // dir { path: '/tmp/test/1512307052918140484Pnv1m95ZS2b' }

generateTmpName({dir: '/tmp/test'}).then((r) => console.log('name', r));
    // name { path: '/tmp/test/151230705292114048hb3XIds0FO9Y' }

```
## Functions

<dl>
<dt><a href="#generateFile">generateFile([options])</a> ⇒ <code>promise</code></dt>
<dd></dd>
<dt><a href="#generateDir">generateDir([options])</a> ⇒ <code>promise</code></dt>
<dd></dd>
<dt><a href="#generateTmpName">generateTmpName([options])</a> ⇒ <code>promise</code></dt>
<dd></dd>
</dl>

<a name="generateFile"></a>

## generateFile([options]) ⇒ <code>promise</code>
**Kind**: global function  
**Returns**: <code>promise</code> - - { path: ..., cleanupCallback: ... } calling cleanupCallback() removes the generated file  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | <code>object</code> |  |  |
| [options.mode] | <code>number</code> | <code>0600</code> | the file mode to create with, defaults to 0600 on file and 0700 on directory |
| [options.prefix] | <code>string</code> | <code>&quot;Date.now()&quot;</code> | the optional prefix, fallbacks to tmp- if not provided |
| [options.postfix] | <code>string</code> | <code>&quot;&#x27;.tmp&#x27;&quot;</code> | the optional postfix, fallbacks to .tmp on file creation |
| [options.dir] | <code>string</code> | <code>&quot;/tmp&quot;</code> | the optional temporary directory, fallbacks to system default |
| [options.keep] | <code>boolean</code> | <code>false</code> | if to keep the file |

<a name="generateDir"></a>

## generateDir([options]) ⇒ <code>promise</code>
**Kind**: global function  
**Returns**: <code>promise</code> - - { path: ..., cleanupCallback: ... } calling cleanupCallback() removes the generated file  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | <code>object</code> |  |  |
| [options.mode] | <code>number</code> | <code>0600</code> | the file mode to create with, defaults to 0600 on file and 0700 on directory |
| [options.prefix] | <code>string</code> | <code>&quot;Date.now()&quot;</code> | the optional prefix, fallbacks to tmp- if not provided |
| [options.postfix] | <code>string</code> | <code>&quot;&#x27;.tmp&#x27;&quot;</code> | the optional postfix, fallbacks to .tmp on file creation |
| [options.dir] | <code>string</code> | <code>&quot;/tmp&quot;</code> | the optional temporary directory, fallbacks to system default |
| [options.keep] | <code>boolean</code> | <code>false</code> | if to keep the file |

<a name="generateTmpName"></a>

## generateTmpName([options]) ⇒ <code>promise</code>
**Kind**: global function  
**Returns**: <code>promise</code> - - { path: ... }  

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | <code>object</code> |  |  |
| [options.mode] | <code>number</code> | <code>0600</code> | the file mode to create with, defaults to 0600 on file and 0700 on directory |
| [options.prefix] | <code>string</code> | <code>&quot;Date.now()&quot;</code> | the optional prefix, fallbacks to tmp- if not provided |
| [options.postfix] | <code>string</code> | <code>&quot;&#x27;.tmp&#x27;&quot;</code> | the optional postfix, fallbacks to .tmp on file creation |
| [options.dir] | <code>string</code> | <code>&quot;/tmp&quot;</code> | the optional temporary directory, fallbacks to system default |

---
_Source: https://npm.io/package/@coolgk/tmp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
