peek-preview
v1.0.0
Published
Smart file previewer for terminal — JSON pretty, CSV tables, markdown & code with line numbers. Cross-platform cat on steroids.
Maintainers
Readme
peek 👀 — cat on steroids
Smart file previewer for your terminal. JSON pretty • CSV tables • Markdown render • Code with line numbers. Works everywhere — especially on Windows where
bat/jqdon't exist.
Why peek?
On Linux/Mac you have bat, jq, csvlook... On Windows you only have:
| Windows built-in | what it does | missing |
|---|---|---|
| type file.txt / Get-Content file.txt | dumps raw text | no colors, no truncation, chokes on big files |
| more file.txt | paginated dump | no syntax highlight |
| Get-Content -Head 20 / -Tail 20 | first/last N lines | manual, no auto-detect |
peek = one tool for all:
peek file.json # pretty + colored
peek data.csv # nice table, 20 rows + summary
peek README.md # markdown rendered
peek app.js --lines 50 # code with line numbers + header
peek data.json --query users.0.name # jq-lite
cat data.json | peek # pipe support
peek ./src # directory listingInstall
# global (install once, use everywhere)
npm i -g peek-preview
peek README.md
# one-off without install — npx (recommended)
npx peek-preview README.md
npx peek-preview data.json --query users.0.name
# local development
git clone https://github.com/not0kkinex/peek
cd peek
npm install
npm link # makes `peek` available globally for dev
peek examples/sample.jsonUsage
Usage: peek [options] [file]
Options:
-j, --json force JSON mode
-c, --csv force CSV mode
-m, --markdown force markdown mode
--raw show raw markdown
-n, --number show line numbers
--no-color disable colors
-l, --lines <n> first N lines
--head <n> first N lines
--tail <n> last N lines
-a, --all disable 300-line truncation
-q, --quiet hide header/footer
--query <path> JSON dot query (users.0.name)
--list list supported typesExamples
JSON
peek examples/sample.json
# {
# "users": [
# { "id": 1, "name": "Ali", "role": "admin" }
# ]
# }
# — object{2 keys} —
peek examples/sample.json --query users.0.name
# "Ali"CSV
peek examples/sample.csv
# ┌─────────┬─────┬──────────┬───────────┐
# │ name │ age │ city │ role │
# ├─────────┼─────┼──────────┼───────────┤
# │ Ali │ 24 │ Istanbul │ developer │
# └─────────┴─────┴──────────┴───────────┘
# 4 rows × 4 colsMarkdown & Code
peek README.md
peek src/cli.js --tail 20
peek big.log --lines 100Features
- Auto-detect by extension (.json/.csv/.md/.js/.py etc), override with flags
- Smart truncation: 300 lines max by default, hint to use
--all - Binary check: skips
\0files - Directory mode:
peek ./folderlists files with sizes - Stdin:
cat file | peek,curl ... | peek --json - Cross-platform: Windows / macOS / Linux, no native deps
Comparison
| Tool | Windows built-in? | JSON | CSV | Markdown | Line numbers |
|---|---|---|---|---|---|
| type / Get-Content | ✅ | ❌ | ❌ | ❌ | ❌ |
| bat | ❌ (needs install) | ✅ | ❌ | ✅ | ✅ |
| jq | ❌ | ✅ | ❌ | ❌ | ❌ |
| peek | ✅ (npm) | ✅ | ✅ | ✅ | ✅ |
Development
git clone https://github.com/not0kkinex/peek
cd peek
npm install
node src/cli.js examples/sample.json
npm test
npm pack --dry-run # inspect package contentsPublish to npm (first time):
npm login
# package name must be available — peek-cli is taken, peek-preview is free
npm publish --access public
# now anyone can run:
npx peek-preview file.jsonRun directly from GitHub without publishing:
npx github:not0kkinex/peek README.mdLicense
MIT
