CHM Commands Reference
Purpose
Complete command-line reference for all CHM (Microsoft Compiled HTML Help) format operations. This document provides detailed syntax, options, and examples for the 4 CHM commands.
Concepts
CHM commands follow the pattern: cabriolet COMMAND [OPTIONS] FILE [ARGS]. Each command operates on CHM (Compiled HTML Help) files for listing, extracting, creating, and getting information.
Command Overview
| Command | Purpose |
|---|---|
List contents of a CHM file | |
Extract files from a CHM archive | |
Display detailed CHM information | |
Create new CHM file |
chm-list - List CHM Contents
Display files contained in a CHM archive without extracting them.
Description
The chm-list command displays all files contained in a CHM archive, showing file names, sizes, and which section (compressed or uncompressed) they are stored in.
Examples
cabriolet chm-list help.chmCHM File: help.chm
Version: 3
Language: 1033
Chunks: 512, Chunk Size: 4096
Files:
/index.html (15,234 bytes, MSCompressed)
/style.css (2,048 bytes, MSCompressed)
/images/logo.png (8,192 bytes, Uncompressed)
/#SYSTEM (512 bytes, Uncompressed)
Total: 4 filescabriolet chm-list --verbose help.chmCHM File: help.chm
Version: 3
Language: 1033
Chunks: 512
Chunk Size: 4096
Directory offset: 8192
First PMGL: 0
Last PMGL: 15
Files:
/index.html
Size: 15,234 bytes
Section: 1 (MSCompressed)
/style.css
Size: 2,048 bytes
Section: 1 (MSCompressed)
/images/logo.png
Size: 8,192 bytes
Section: 0 (Uncompressed)
/#SYSTEM
Size: 512 bytes
Section: 0 (Uncompressed)
System file
Total: 4 files
Compressed files: 2
Uncompressed files: 2chm-extract - Extract CHM Files
Extract all files from a CHM archive to a directory.
Parameters
FILE-
(required) Path to the CHM file to extract
OUTPUT_DIR-
(optional) Directory to extract files to (default: current directory)
Options
--output, -o-
Output directory (alternative to positional argument)
--verbose, -v-
Show extraction progress for each file
Returns
-
Exit code 0 on success
-
Exit code 1 on error
-
Exit code 3 if file not found
-
Exit code 4 if permission denied
Description
The chm-extract command extracts all files from a CHM archive, recreating the directory structure as stored in the CHM. System files (starting with /) are also extracted.
Examples
cabriolet chm-extract help.chmcabriolet chm-extract help.chm output/Extracted 15 file(s) to output/cabriolet chm-extract --verbose help.chm extracted/Opening help.chm...
Version: 3
Language: 1033
Files: 15
Extracting to extracted/
/index.html (15,234 bytes)... OK
/style.css (2,048 bytes)... OK
/images/logo.png (8,192 bytes)... OK
/images/icon.gif (1,024 bytes)... OK
/#SYSTEM (512 bytes)... OK
...
Extraction complete
Total: 15 files extractedcabriolet chm-extract -o docs/ help.chmchm-info - Show CHM Information
Display detailed information about a CHM archive including structure, sections, and files.
Description
The chm-info command provides comprehensive information about a CHM archive, including version, language, directory structure, sections, and file listings.
Examples
cabriolet chm-info help.chmCHM File Information
==================================================
Filename: help.chm
Version: 3
Language ID: 1033
Timestamp: 2024-01-15 14:30:00
Size: 524,288 bytes
Directory:
Offset: 8192
Chunks: 512
Chunk Size: 4096
First PMGL: 0
Last PMGL: 15
Sections:
Section 0 (Uncompressed): offset 2048
Section 1 (MSCompressed): LZX compression
Files: 15 regular, 3 system
Regular Files:
/index.html
Size: 15,234 bytes (Sec1)
/style.css
Size: 2,048 bytes (Sec1)
/images/logo.png
Size: 8,192 bytes (Sec0)cabriolet chm-info --verbose help.chmCHM File Information
==================================================
Filename: help.chm
Version: 3
Language ID: 1033 (English - United States)
Timestamp: 2024-01-15 14:30:00
Size: 524,288 bytes
Directory Structure:
Offset: 8192
Chunks: 512
Chunk Size: 4096 bytes
First PMGL: 0
Last PMGL: 15
Directory pages: 16
Sections:
Section 0 (Uncompressed):
Offset: 2048
Files: 5
Section 1 (MSCompressed):
Compression: LZX
Files: 10
File Statistics:
Total files: 15
Regular files: 12
System files: 3
Compressed (Sec1): 10 files
Uncompressed (Sec0): 5 files
Regular Files:
/index.html
Size: 15,234 bytes
Section: 1 (MSCompressed)
/style.css
Size: 2,048 bytes
Section: 1 (MSCompressed)
/images/logo.png
Size: 8,192 bytes
Section: 0 (Uncompressed)
System Files:
/#SYSTEM
Size: 512 bytes
Section: 0 (Uncompressed)
/#TOPICS
Size: 1,024 bytes
Section: 0 (Uncompressed)
/#URLSTR
Size: 256 bytes
Section: 0 (Uncompressed)chm-create - Create CHM File
Create a new CHM file from HTML and other files.
Options
--window-bits=SIZE-
LZX window size in bits: 15-21 (default: 16)
--verbose, -v-
Show creation progress
Returns
-
Exit code 0 on success
-
Exit code 1 on error
-
Exit code 2 if no files specified
-
Exit code 3 if source files not found
-
Exit code 4 if permission denied
Description
The chm-create command builds a new CHM archive from HTML and resource files. HTML files are compressed in Section 1 (MSCompressed), while images and other media are stored uncompressed in Section 0.
Examples
cabriolet chm-create help.chm index.html style.css logo.pngCreated help.chm (45,056 bytes, 3 files)cabriolet chm-create --window-bits=21 help.chm docs/*.htmlCreated help.chm (128,512 bytes, 15 files)cabriolet chm-create --verbose --window-bits=18 help.chm index.html style.cssCreating help.chm with window_bits: 18
Adding files:
index.html -> /index.html (compressed)
Original: 15,234 bytes
Section: 1 (MSCompressed)
style.css -> /style.css (compressed)
Original: 2,048 bytes
Section: 1 (MSCompressed)
Writing CHM structure...
ITSF header: 96 bytes
Directory chunks: 4,096 bytes
Section 0 (Uncompressed): 0 bytes
Section 1 (MSCompressed): 8,192 bytes
Created help.chm
Total: 2 files
Compressed size: 12,384 bytes
Compression ratio: 28.1%cabriolet chm-create help.chm html/*.html images/*.pngGlobal Options
All CHM commands support these global options:
--verbose, -v-
Enable verbose output with detailed progress
--help, -h-
Display command help
--version-
Show Cabriolet version
See link: for complete details.
Exit codes
| Code | Meaning |
|---|---|
0 | Success |
1 | General error |
2 | Invalid arguments |
3 | File not found |
4 | Permission denied |
5 | Corrupt archive |
6 | Unsupported format |
Next steps
-
Review Basic Usage Guide for usage examples
-
Study Ruby API Reference for Ruby integration
-
Learn about compression algorithms