1. tempfile
Get a random temporary file path
tempfile
Package: tempfile
Created by: sindresorhus
Last modified: Sun, 12 Feb 2023 06:34:26 GMT
Version: 5.0.0
License: MIT
Downloads: 6,196,886
Repository: https://github.com/sindresorhus/tempfile

Install

npm install tempfile
yarn add tempfile

tempfile

Get a random temporary file path

Checkout out tempy which is a better take on this module.

Install

 npm install tempfile

Usage

 import tempfile from 'tempfile';

tempfile();
//=> '/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/6271e235-13b9-4138-8b9b-ee2f26c09ce3'

API

tempfile(options?)

options

Type: object

extension

Type: string

A file extension to append to the path.

 import tempfile from 'tempfile';

tempfile();
//=> '/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/6271e235-13b9-4138-8b9b-ee2f26c09ce3'

tempfile({extension: 'png'});
//=> '/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T/4049f192-43e7-43b2-98d9-094e6760861b.png'
  • tempy - Get a random temporary file or directory path
  • temp-write - Write string/buffer/stream to a random temp file

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code