A TypeScript tool to convert MHTML files to standalone HTML.
Convert an MHTML file to HTML:
npx mhtml-html <path-to-mhtml-file> [output-file]Examples:
# Output to console
npx mhtml-html document.mhtml
# Save to file
npx mhtml-html document.mhtml output.html
# Support for tilde expansion
npx mhtml-html ~/Downloads/document.mhtml ~/Desktop/output.htmlimport { parseMhtmlFile, extractMhtmlToHtml } from 'mhtml-html';
// Parse MHTML and get structured data
const result = await parseMhtmlFile('document.mhtml');
console.log(result.html, result.resources, result.title);
// Extract directly to standalone HTML
const html = await extractMhtmlToHtml('document.mhtml');# Install dependencies
npm install
# Build the project
npm run build
# Run in development mode
npm run dev <input-file>To build the project from source, you'll need to have Node.js and npm installed.
-
Clone the repository:
git clone https://github.com/varlabz/mhtml-html.git cd mhtml-html -
Install the dependencies:
npm install
-
Build the project:
npm run build