1. unique-temp-dir
Provides a uniquely named temp directory.
unique-temp-dir
Package: unique-temp-dir
Created by: jamestalmage
Last modified: Sat, 17 Jun 2023 00:09:31 GMT
Version: 1.0.0
License: MIT
Downloads: 419,232
Repository: https://github.com/jamestalmage/unique-temp-dir

Install

npm install unique-temp-dir
yarn add unique-temp-dir

unique-temp-dir Build Status

Provides a uniquely named temp directory.

Install

$ npm install --save unique-temp-dir

Usage

 const uniqueTempDir = require('unique-temp-dir');

uniqueTempDir();
//=> '/var/folders/2_/zg9h6_xd4r3_z7c07s0cn8mw0000gn/T/PpCfz55ANU2hdwnGzgny'

uniqueTempDir();
//=> '/var/folders/2_/zg9h6_xd4r3_z7c07s0cn8mw0000gn/T/qfqafhh1FJulehbCDAPk'

API

uniqueTempDir([options])

Returns a string that represents a unique directory inside the systems temp directory.

options

create

Type: boolean
Default: false

If true, the directory will be created synchronously before returning.

length

Type: number
Default: 20

The length of the directory name inside the temp directory.

thunk

Type: boolean
Default: false

If true, returns a thunk function for path.join(uniqueTempDir, ... additionalArgs). Useful for filling your directory up with stuff.

 const uniqueTempDir = require('unique-temp-dir');
const tempDir = uniqueTempDir({thunk: true});

tempDir()
//=> /user/temp/uniqueId

tempDir('foo')
//=> /user/temp/uniqueId/foo

tempDir('bar')
//=> /user/temp/uniqueId/bar

License

MIT © James Talmage

RELATED POST

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin