@kszongic/tmpfile-cli
v1.0.0
Published
Create temporary files and directories from the command line
Maintainers
Readme
@kszongic/tmpfile-cli
Create temporary files and directories from the command line. Zero dependencies. Works on macOS, Linux, and Windows.
Install
npm i -g @kszongic/tmpfile-cliUsage
# Create an empty temp file
tmpfile
# /tmp/tmp-a1b2c3d4e5f6
# Create a temp directory
tmpfile -d
# With extension
tmpfile -s .json
# With prefix and suffix
tmpfile -p log- -s .txt
# Write content directly
tmpfile -c "hello world"
# Pipe stdin
echo "some data" | tmpfile
# Custom base directory
tmpfile -t ./my-tmp
# Dry run (just print the path)
tmpfile --dry-run -s .logOptions
| Flag | Description |
|------|-------------|
| -d, --dir | Create a directory instead of a file |
| -p, --prefix STR | Name prefix (default: tmp-) |
| -s, --suffix STR | Name suffix / extension |
| -t, --tmpdir DIR | Base directory (default: os.tmpdir()) |
| -c, --content STR | Write content to the file |
| --dry-run | Print path without creating anything |
| -h, --help | Show help |
| -v, --version | Show version |
License
MIT © 2026 kszongic
