Skip to content

refactor: replace temp package with Node built-in fs.mkdtemp#599

Open
thedavidweng wants to merge 1 commit into
electron:mainfrom
thedavidweng:refactor/replace-temp-with-builtins
Open

refactor: replace temp package with Node built-in fs.mkdtemp#599
thedavidweng wants to merge 1 commit into
electron:mainfrom
thedavidweng:refactor/replace-temp-with-builtins

Conversation

@thedavidweng

Copy link
Copy Markdown

What

Replace the temp package with Node's built-in fs.mkdtemp + os.tmpdir.

Why

The temp package (v0.9.4) was last released in November 2020 and is effectively unmaintained. It pins deprecated transitive dependencies:

temp@0.9.4 -> rimraf@~2.6.2 -> glob@7.2.3 -> inflight@1.0.6

All four packages are deprecated. inflight is also flagged for memory leaks (CWE-772).

The only usage of temp in this project is creating a single temporary directory via createTempDir('si-') in src/index.ts:161, which maps directly to Node's built-in fs.mkdtemp.

Changes

  • src/temp-utils.ts: Replace temp.mkdir with fs.mkdtemp + os.tmpdir + path.join
  • package.json: Remove temp from dependencies and @types/temp from devDependencies

Compatibility

  • fs.mkdtemp has been stable since Node 5.10.0
  • util.promisify has been stable since Node 8.0.0
  • Both are within the existing engine requirement of >=8.0.0
  • The exported createTempDir function signature and return type are unchanged

Notes

This is a revival of #584 (closed by the original author). The approach is identical — the only difference is using path.join(tmpdir(), prefix) for clarity.

Closes #581

The temp package (v0.9.4, last released November 2020) depends on
rimraf@~2.6.2 -> glob@7.2.3 -> inflight@1.0.6, all of which are
deprecated. inflight is also flagged for memory leaks (CWE-772).

The only usage of temp in this project is creating a single temporary
directory via createTempDir, which maps directly to Node's built-in
fs.mkdtemp combined with os.tmpdir.

This removes the temp and @types/temp dependencies entirely, eliminating
the deprecated transitive dependency chain.

fs.mkdtemp has been stable since Node 5.10.0 and util.promisify since
Node 8.0.0, both within the existing engine requirement of >=8.0.0.
The exported createTempDir function signature and return type are
unchanged.
@thedavidweng thedavidweng requested a review from a team as a code owner June 13, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop using temp and replace it with tempy

1 participant