
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
The temp-dir npm package provides a simple way to get the path to the system's temporary directory. This can be useful for creating temporary files or directories that you don't need to persist between sessions.
Get Temporary Directory Path
This feature allows you to retrieve the path to the system's temporary directory. This is useful for creating temporary files or directories.
const tempDir = require('temp-dir');
console.log(tempDir);
The os-tmpdir package provides a similar functionality by returning the path of the operating system's default directory for temporary files. It is a lightweight package and can be used as an alternative to temp-dir.
The tmp package offers more advanced functionality for working with temporary files and directories. It can create temporary files and directories, and it also handles cleanup automatically. This makes it more feature-rich compared to temp-dir.
The temp package provides utilities for creating temporary files and directories, similar to tmp. It also includes features for tracking and cleaning up temporary files, making it a more comprehensive solution compared to temp-dir.
Get the real path of the system temp directory
The os.tmpdir()
built-in doesn't return the real path. That can cause problems when the returned path is a symlink, which is the case on macOS. Use this module to get the resolved path.
$ npm install temp-dir
const tempDirectory = require('temp-dir');
console.log(tempDirectory);
//=> '/private/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T'
console.log(require('os').tmpdir());
//=> '/var/folders/3x/jf5977fn79jbglr7rk0tq4d00000gn/T' // <= Symlink
MIT © Sindre Sorhus
FAQs
Get the real path of the system temp directory
The npm package temp-dir receives a total of 11,633,275 weekly downloads. As such, temp-dir popularity was classified as popular.
We found that temp-dir demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.