Big Hex Viewer
中文简介:HxD 风格的二进制查看/编辑器。偏移列 + 十六进制字节列 + ASCII 列经典布局,虚拟滚动支持超大文件(10GB+)流畅浏览,O(1) 偏移跳转、字节序列/文本查找、选区复制为十六进制或文本、覆盖式编辑与就地保存(不改文件长度)。默认只读,编辑需显式开启。
HxD-style hex viewer and in-place editor for any file — built for huge files.
Features
- Classic HxD layout, three-color columns: uppercase zero-padded offset column, hex byte column (8/16/32 bytes per row, optional grouping) and a decoded text column — offsets, hex and text each have their own theme-aware color. Unprintable code points render as
.. Every row always renders the full row width, so the last short row stays aligned.
- Text encoding switch: the text column decodes with the selected encoding — auto-detect (BOM + 64 KB heuristic) or UTF-8, UTF-16LE/BE, GBK, GB18030, Big5, Shift-JIS, EUC-KR, Windows-1252, ISO-8859-1, ASCII. Multi-byte characters that straddle a row boundary are decoded with context, so CJK text stays intact.
- Huge-file ready: virtualized scrolling with a fixed-height scroll domain — a 10 GB file at 16 bytes/row is 625 million rows; rows are mapped linearly onto a 1 MiB-px spacer (Chromium clamps native scroll heights near 33.5M px, so native total height is not an option). Only the viewport + overscan rows exist in the DOM.
- O(1) offset navigation (
Ctrl+G): jump with decimal (1048576), hex (0x100000) or size suffixes (16, 1KB, 2MB, 3G) — row = offset / bytesPerRow, no scan needed.
- Find (
Ctrl+F / F3): plain-text search, or exact byte sequences with the hex: prefix (hex:DE AD BE EF); matches are highlighted and F3 cycles through them.
- Byte-accurate selection + right-click menu: click / drag / Shift+click in either the hex or the text column (both stay in sync); right-click never collapses the selection and opens a menu with Copy content and Copy byte string. In edit mode the menu also offers Cut (copy + zero-fill; overwrite semantics, the file length never changes) and Paste (hex bytes, or text when the selected encoding has an encoder).
Ctrl+C / Ctrl+X / Ctrl+V follow the same rules; cut and paste are disabled outside edit mode.
- Top-anchored, draggable dialogs: Find (
Ctrl+F) and Go to offset (Ctrl+G) open just below the toolbar — the rows you are inspecting stay visible and clickable while the dialog is open — and can still be dragged anywhere; transient messages appear in a centered, draggable toast.
- Overwrite editing (opt-in): toggle with a confirmation, then type hex nibbles in the hex column or ASCII characters in the text column; modified bytes are highlighted red (HxD style),
Ctrl+Z undoes, Ctrl+S saves in place — the file size never changes.
- Safe save: before writing, the extension verifies the file's size and mtime are unchanged since it was opened; if anything touched the file externally, the save is refused with a clear message (reopen to pick up the new content). Hex saves are always in-place overwrites.
- Localized 中文/English UI strings follow VSCode's display language.
Extension Settings
| Setting |
Default |
Description |
viewhexfile.bytesPerRow |
16 |
Bytes per row: 8, 16 (classic) or 32 — applies live to open viewers |
viewhexfile.bytesPerGroup |
1 |
Extra spacing every 1/2/4/8 bytes in the hex column |
viewhexfile.encoding |
auto |
Text-column/copy/search encoding: auto or utf-8, utf-16le, utf-16be, gbk, gb18030, big5, shift_jis, euc-kr, windows-1252, iso-8859-1, ascii |
Keyboard Shortcuts
Active while the hex viewer is focused:
| Key |
Command |
Ctrl + mouse wheel |
Zoom the hex font in / out (trackpad pinch works too); Ctrl+0 resets to the theme font size |
Ctrl+= / Ctrl+- |
Zoom in / out (this viewer only, not the workbench) |
Ctrl+F |
Find (text or hex: bytes) |
F3 |
Find next match |
Ctrl+G |
Go to offset (decimal / 0x hex / 1KB-style) |
PageUp / PageDown |
Scroll a screen (outside edit mode) |
Home / End |
Jump to the first / last row (outside edit mode) |
Ctrl+S |
Save (only in edit mode) |
Ctrl+C |
Copy selection — hex format from the hex column, text from the ASCII column (handled inside the viewer; not a global keybinding, so normal editor copying is never hijacked) |
Ctrl+Z |
Undo last byte edit (edit mode) |
Environment: Windows 11, AMD Ryzen 7 7840HS, NVMe SSD (F:), Node 26.4.0,
VSCode 1.144.0. The 12.4 GB and 53.3 GB files are VMware disk images used as
large binary stress files.
| File |
Size |
Open |
1000 random 50-row reads |
Full-file byte search |
| Synthetic log |
1.0 GiB |
0.3 ms |
55 ms |
1.10 s (120 hits) |
| Synthetic binary |
1.0 GiB |
0.3 ms |
52 ms |
1.10 s (0 hits) |
| VM disk image |
12.4 GB |
0.3 ms |
66 ms |
11.4 s (0 hits) |
| VM disk image |
53.3 GB |
0.4 ms |
414 ms |
451.8 s (0 hits) |
Open is O(1) (no index); random reads go through the 64 KB LRU, and the search
column is a cold full scan (the 1 GiB log finds the planted needle 120 times;
the other rows search for a needle that does not occur).
Limitations (by design, v0.2)
- Overwrite mode only: editing replaces byte values; inserting or deleting bytes (changing the file length) is not supported. Cut therefore copies and zero-fills the selected bytes; paste overwrites without changing the length.
- Backspace/Delete move the cursor without altering bytes.
- No automatic reload on external changes — detected and refused at save time instead.
- Text search/paste is encoded with the selected encoding. GBK/Big5/Shift-JIS/EUC-KR have no encoder in Node: ASCII text search/paste works, non-ASCII text is refused — use hex bytes (
hex: prefix or the Hex bytes checkbox) for CJK content.
Build & install locally
Run from this directory:
npm install
npm run typecheck # tsc --noEmit
npm run compile # esbuild → out/extension.js + out/webview.bundle.js
npm test # unit tests
npm run test:integration # full stack in a real VSCode host
npx vsce package --allow-missing-repository
code --install-extension viewhexfile-0.2.1.vsix
Then right-click any file in the Explorer → Open with Big Hex Viewer.
Support
See SUPPORT.md, or write to fenyuesupport@163.com —
please include your VSCode version (Help → About) and the steps to reproduce.
License
MIT — see the LICENSE file in the repository.
| |