Big File Viewer
Open huge text and log files — gigabytes — without loading them into memory.
Built for the files the built-in editor chokes on: multi-gigabyte logs, exports
and data dumps.
Features
- Instant open — the viewer reads only the bytes it renders; nothing is
loaded wholesale.
- Virtualized scrolling — 40-million-line files scroll smoothly. Row
positions map onto a capped spacer height, so the Chromium scroll clamp
(~33.5M px) is never a limit.
- Background line index — a one-pass streaming scan counts lines and
samples line offsets; while it runs you already see content and an estimated
line count.
- Streaming search (Ctrl+F) — whole-file search with progress, case
toggle, next/previous hit navigation (F3 / Shift+F3) and jump-to-hit.
UTF-8 files support case-insensitive search; UTF-16 files are searched in
the byte-exact domain (case-sensitive only).
- Go to line (Ctrl+G) — 1-based line jump.
- Encoding support — auto-detect (BOM + 64 KB sample) or choose UTF-8,
UTF-16LE/BE, GBK, GB18030, Big5, Shift-JIS, EUC-KR, Windows-1252,
ISO-8859-1 or ASCII from the toolbar. ASCII-compatible encodings keep the
same 0x0A line grid; a UTF-16 endianness or 1-byte↔2-byte switch rebuilds
the line index automatically. Legacy CJK encodings
decode for viewing and search, and accept ASCII-only line edits (Node ships
no encoder for those code pages).
- Syntax highlighting — a lightweight per-line highlighter for
JavaScript/TypeScript, JSON, C/C++, Python, shell, Go, Rust, Java, SQL,
YAML, INI, markup, CSS and Markdown, plus timestamp/log-level coloring in
.log files. Toggle with viewbigfile.syntaxHighlight (default on).
- Editor tab width — Tab characters render at your
editor.tabSize
(display only: the file is never rewritten with expanded spaces).
- Top-anchored, draggable dialogs — Find (
Ctrl+F) and Go to Line
(Ctrl+G) open just below the toolbar and can be moved anywhere; the viewer
below stays fully interactive while the dialog is open. Transient messages
appear in a centered, draggable toast.
- Horizontal scrolling — long lines get a real horizontal scrollbar; line
numbers stay pinned to the left while you scroll sideways.
- Word wrap (default on) — toolbar Wrap toggle or
viewbigfile.wordWrap; turn it off to switch to the horizontal scrollbar.
Files up to 10,000 lines render every line at its natural height (each
long line wraps, short lines stay compact — no blank gaps). Larger files keep
a fixed row height so virtual scrolling still works; size it with
viewbigfile.wrapLines (0 = derive from the longest line in the file).
- Line editing, opt-in — the viewer is read-only until you explicitly
enable editing (with a confirmation). Editing replaces whole lines; Save
(Ctrl+S) patches same-length lines in place and rewrites the file when any
line changed length. If the file changed on disk since it was opened, the
save is refused.
- Big-file prompt — opening a text file larger than
viewbigfile.autoOpenThresholdMB in the built-in editor offers to reopen it
here instead.
- English / Chinese UI — follows the display language.
Keyboard & zoom
| Action |
Shortcut |
| Zoom rows in / out |
Ctrl + mouse wheel (or trackpad pinch), Ctrl+= / Ctrl+- |
| Reset zoom (follow the editor font size) |
Ctrl+0 |
| Scroll |
Wheel, scrollbar, ↑ ↓ PageUp PageDown — click the text area first |
| First / last line |
Home / End (also with Ctrl) |
| Find / next / previous hit |
Ctrl+F, F3, Shift+F3 |
| Go to line |
Ctrl+G |
| Save (edit mode) |
Ctrl+S |
Zoom only changes the row font of this viewer — the workbench zoom level is
untouched. The chosen size is remembered across tabs and restarts, and
Ctrl+0 returns to the theme's editor font size. In a virtualized view
Ctrl+A can only select the rendered rows, so the viewer says so instead of
silently copying a partial selection.
Extension Settings
viewbigfile.autoOpenThresholdMB (default 100) — files above this size
trigger the "open in Big File Viewer?" prompt when opened with the built-in
editor. 0 disables the prompt.
viewbigfile.maxLineDisplayChars (default 2000) — characters fetched and
rendered per line; longer lines are truncated with an ellipsis marker
(display only — the file is never modified).
viewbigfile.encoding (default auto) — text encoding used for line
decoding and search. auto uses a BOM and a 64 KB heuristic; explicit
values: utf8, utf16le, utf16be, gbk, gb18030, big5,
shift_jis, euc-kr, windows-1252, iso-8859-1, ascii.
viewbigfile.syntaxHighlight (default true) — per-line syntax coloring
of the visible rows (see the language list above).
viewbigfile.wordWrap (default true) — wrap long lines instead of using
the horizontal scrollbar. The toolbar Wrap button toggles the same mode
for the current panel; turn it off to get the horizontal scrollbar.
viewbigfile.wrapLines (default 0) — visual lines per wrapped row for
files above 10,000 lines: 0 = derive from the longest line in the file,
1–100 = fixed cap. Files up to 10,000 lines use natural heights and
ignore this setting.
Environment: Windows 11, AMD Ryzen 7 7840HS, NVMe SSD (F:), Node 26.4.0,
VSCode 1.144.0. The 1 GiB text is a synthetic log; the 12.4 GB and 53.3 GB
files are VMware disk images used as large stress files — for a big-file
viewer a "line" is a byte 0x0A/0x0D split, so their line counts describe
the stress input, not log content.
| File |
Size |
Open |
First paint |
Full line index |
100 random 60-line windows |
Full-file search |
| Synthetic log |
1.0 GiB (8,460,120 lines) |
2.4 ms |
0.6 ms |
2.97 s |
86 ms |
0.46 s (120 hits) |
| VM disk image |
12.4 GB (100.5 M lines) |
2.8 ms |
53 ms |
106.2 s |
122 ms |
16.8 s (0 hits) |
| VM disk image |
53.3 GB (425.9 M lines) |
4.0 ms |
155 ms |
427.3 s |
241 ms |
265.0 s (0 hits) |
Search is a cold full scan for a needle that does not occur (0 hits), so the
number is the whole-file throughput; the 1 GiB log search finds the planted
needle 120 times.
How it stays fast
- Positioned reads: every fetch is an
fs.read at an explicit offset
through a bounded LRU of 64 KB-aligned windows — memory does not grow with
file size.
- Background line index: one streaming pass records every 1024th line
start in a compact array; line lookups seek to the nearest sample and walk
forward.
- Virtualized rows: only the visible rows (plus a small overscan) exist in
the DOM; scrolling maps positions onto a capped spacer instead of a native
total height.
- Streaming search: fixed-size chunks with overlap for boundary matches;
hit collection is capped and cancellable.
- All file offsets are handled as plain 64-bit-safe numbers — multi-gigabyte
files never truncate at 2 GB.
Editing limitations (by design)
- Editing is line-level: click a line, type, Enter commits (and moves to
the next line), Esc cancels. There is no free-form text editing.
- Saving lines whose byte length changed rewrites the entire file via a
same-directory temp file and an atomic rename; unchanged-length lines are
patched in place.
- No automatic reload on external changes: the save-time size + mtime check
refuses to overwrite a file that changed on disk.
- Legacy CJK encodings (GBK/Big5/Shift-JIS/EUC-KR) have no encoder in Node:
lines are editable only while the new text stays ASCII; non-ASCII edits are
refused rather than written as garbage.
- Display-truncated lines (longer than
viewbigfile.maxLineDisplayChars) are
not editable — committing the visible slice would delete the rest of the
line. Raise the limit or use the built-in editor.
- Syntax highlighting is per line: block comments and multi-line strings are
not tracked across lines (a big-file viewer must never scan the file to
color a viewport row).
Build & install locally
cd bigfile
npm install
npm run typecheck
npm run compile
npm test # unit + smoke tests (no VSCode needed)
npm run test:integration # real VSCode host via @vscode/test-electron
npx vsce package --allow-missing-repository
code --install-extension viewbigfile-0.2.4.vsix --force
Support
See SUPPORT.md.
License
MIT
| |