tempfile2
v2.0.4
Published
Get a random temp file path. much better.
Downloads
361
Maintainers
Readme
tempfile2
Get a random temp file path. much better. Compatible with tempfile.
Install
npm install tempfile2 --save
Usage
var tempfile2 = require('tempfile2');
tempfile({ext:'.png'});
//=> /var/folders/_1/tk89k8215ts0rg0kmb096nj80000gn/T/4049f192-43e7-43b2-98d9-094e6760861b.png
tempfile({path: '/my/custom/path/', ext:'.png'});
//=> /my/custom/path/4546h192-42b1-43b2-41d9-023e6730432c.png
tempfile('.png');
//=> /var/folders/_1/tk89k8215ts0rg0kmb096nj80000gn/T/25c24272-2269-11e5-a17f-82bd40254040.png
API
tempfile([options])
options.path
Type: string
Optionally supply the root path. By default uses os temp dir.
options.name
Type: string
Optionally supply the file name. by default uses a unique file name based in uuid v4 algorithm
options.ext
Type: string
Optionally supply an extension to append to the path.
If options
is a string
, then it is assumed to be the extension.
Related
- create-temp-file2 – Creates a temporary file, returns a write stream, a path, and cleanup functions.
License
MIT © Kiko Beats