The sync version of tmp just for test cases, making it much easier.


Keywords
tmp-sync, temporary, tmp, temp, tempdir, tempfile, tmpdir, tmpfile
License
MIT
Install
npm install tmp-sync@1.1.2

Documentation

tmp-sync NPM version Build Status Dependency Status

The sync version of tmp just for test cases, making our life it much easier.

Why?

I got tired of write asynchronous codes of tmp even just in test cases.

Only use this package in your test cases, not in production environment for you should always using asynchronous fs.

Usage

var tmp = require('tmp-sync');

tmp.in([root])

  • root path= the root path for the temp directory (optional, default to OS tmp directory)

Makes a temp dir inside root and returns the newly created dir. The dir will be automatically tmp.mark()ed.

tmp.mark(dir)

  • dir path the path of a directory

Marks a dir, and the dir will be removed when the current process exits.

tmp.clean()

Cleans all marked tmp dirs. Most usually you need not to call this method manually.