How to use the tmpdir function from osenv

Find comprehensive JavaScript osenv.tmpdir code examples handpicked from public code repositorys.

osenv.tmpdir is a method in Node.js that returns the directory path of the user's temporary directory.

70
71
72
73
74
75
76
77
78
if (!stableFamily || (+stableFamily.minor % 2)) stableFamily = null
else stableFamily = stableFamily.major + '.' + stableFamily.minor

var defaults

var temp = osenv.tmpdir()
var home = osenv.home()

var uidOrPid = process.getuid ? process.getuid() : process.pid
fork icon49
star icon518
watch icon38

35
36
37
38
39
40
41
42
43
44

## osenv.prompt()

Either PS1 on unix, or PROMPT on Windows.

## osenv.tmpdir()

The place where temporary files should be created.

## osenv.home()
fork icon19
star icon22
watch icon13

How does osenv.tmpdir work?

The osenv.tmpdir function returns the path of the system's temporary directory. It checks the TMPDIR, TMP, and TEMP environment variables in order and returns the first defined value. If none of these are defined, it returns the default temporary directory for the current operating system.

Ai Example

1
2
3
const osenv = require("osenv");
const tmpdir = osenv.tmpdir();
console.log(tmpdir); // prints the path of the temporary directory