tmp

Temporary file and directory creation library for Node.js. Creates temporary files and directories in the OS temp directory with unique names, automatic cleanup (on process exit or explicit), and configurable prefix/suffix/extension. Used in testing, file processing pipelines, and any scenario requiring secure temporary file handling. Simpler alternative to writing your own os.tmpdir() + crypto.randomBytes() logic.

Evaluated Mar 06, 2026 (0d ago) v0.2.x
Homepage ↗ Repo ↗ Developer Tools temp-files temporary file-system node testing utilities
⚙ Agent Friendliness
67
/ 100
Can an agent use this?
🔒 Security
95
/ 100
Is it safe for agents?
⚡ Reliability
88
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
85
Error Messages
80
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
88
Secret Handling
82

Temp files in OS temp directory may be world-readable on some systems. For sensitive temp data, use chmod after creation. Cleanup is critical to prevent sensitive data leakage.

⚡ Reliability

Uptime/SLA
90
Version Stability
88
Breaking Changes
88
Error Recovery
85
AF Security Reliability

Best When

You need simple, reliable temporary file/directory creation with automatic cleanup in Node.js scripts, tests, or processing pipelines.

Avoid When

You need cross-process temp file sharing or cloud-based temp storage.

Use Cases

  • Create temporary files for test fixtures that need to be cleaned up after tests
  • Write intermediate processing artifacts to temp files during multi-step file transformation pipelines
  • Generate temporary directory for file extraction, processing, and cleanup in CI/CD scripts
  • Create temp files for subprocess communication (passing large data to CLI tools via file arguments)
  • Safe temporary file handling in upload processing — write to temp, process, move to permanent storage

Not For

  • Long-lived files that need persistence — use regular file I/O for permanent files
  • High-security temporary data — OS temp dir may have permissive permissions; use secure tempfile creation for sensitive data
  • Cloud-based file temp storage — tmp uses local filesystem; use cloud storage for cross-instance temp files

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No authentication — local file system utility.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Fully free, MIT licensed.

Agent Metadata

Pagination
none
Idempotent
Partial
Retry Guidance
Not documented

Known Gotchas

  • Cleanup with unsafeCleanup: true required for non-empty temp directories — default cleanup only removes empty directories; data files must be cleaned explicitly
  • Process exit cleanup requires GracefulCleanup registration — call tmp.setGracefulCleanup() at startup to ensure temp files are deleted on SIGTERM/SIGINT
  • Synchronous API (tmp.fileSync()) blocks event loop — use async API (tmp.file()) in server applications and event-driven code
  • OS temp directory location varies — /tmp on Linux/macOS, C:\Users\...\AppData\Local\Temp on Windows; don't hardcode temp paths
  • Temp file ownership: files are created with current process permissions — in multi-user scenarios, ensure temp files have restrictive permissions for sensitive data
  • tmp package is minimally maintained — consider tempfile (sindresorhus) or tempy for ESM-first modern alternatives

Alternatives

Full Evaluation Report

Comprehensive deep-dive: security analysis, reliability audit, agent experience review, cost modeling, competitive positioning, and improvement roadmap for tmp.

AI-powered analysis · PDF + markdown · Delivered within 30 minutes

$99

Package Brief

Quick verdict, integration guide, cost projections, gotchas with workarounds, and alternatives comparison.

Delivered within 10 minutes

$3

Score Monitoring

Get alerted when this package's AF, security, or reliability scores change significantly. Stay ahead of regressions.

Continuous monitoring

$3/mo

Scores are editorial opinions as of 2026-03-06.

5229
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered