
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
mhtml2html
Advanced tools
mhtml2html converts MHTML files to a single HTML file using javascript.
Usage | API | Development
mhtml2html is compatible with Node >= v10.
It has only been tested with MHTML files built and used with the latest versions of Chrome
mhtml2html can be used via the command line (use the --help flag to view all options):
$ mhtml2html <input.mhtml> <output.html>
For programmatic usage, mhtml2html can be used provided a WHATWG DOM parser implementation (e.g jsdom):
const mhtml2html = require('mhtml2html');
const { JSDOM } = require('jsdom');
const mhtml = '<your MHTML string>';
const htmlDoc = mhtml2html.convert(mhtml, { parseDOM: (html) => new JSDOM(html) });
console.log(htmlDoc);
To get started, import mhtml2html:
import mhtml2html from 'mhtml2html';
Or include it as a script in your webpage:
<script src="https://unpkg.com/mhtml2html@<VERSION>" type="javascript" />
By default, mhtml2html will use the DOMParser available in most browsers:
import mhtml2html from 'mhtml2html';
const mhtml = '<your MHTML string>';
const html = mhtml2html.convert(mhtml);
console.log(html);
mhtml2html.parse(mhtml, { htmlOnly = false, parseDOM = <function> });
DOMParser only available in browsers).htmlOnly is set to true. Otherwise it returns an MHTML parsed object:{
"index" : "<html-index-url>",
"media": {
"<asset-url>" : {
"data" : "<resource-string>",
"id": "<frame-id>",
"type": "<resource-type>",
"encoding": "<resource-encoding>"
}
},
"frames": {
"<frame-id>": {
"data": "<resource-string>",
"id": "<frame-id>",
"type:": "<resource-type>",
"encoding": "<resource-encoding>"
}
}
}
mhtml2html.convert(mhtml, { convertIframes = false, parseDOM = <function> });
DOMParser only available in browsers).To build and test mhtml2html:
node_modules haven't been installed already, run yarn install from the root directory.yarn test to build and test the source code.Released under the MIT License
FAQs
Converts an mhtml document to a single html document
The npm package mhtml2html receives a total of 1,104 weekly downloads. As such, mhtml2html popularity was classified as popular.
We found that mhtml2html demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.