
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
mhtml2html
Advanced tools
mhtml2html converts MHTML files to a single HTML file using javascript.
Usage | API | Development
mhtml2html is compatible with Node >= v4.3.2.
It has only been tested with MHTML files built and used with the latest versions of Chrome
'use strict';
const mhtml2html = require('mhtml2html');
fs.readFile('input.mhtml', 'utf8', function (err, input) {
if (err) {
throw err;
}
// Returns the html document with embedded resources.
const htmlDocument = mhtml2html.convert(input);
// Output the html file.
fs.writeFile('output.html', htmlDocument.documentElement.innerHTML, err => {
if(err) {
return console.log(err);
}
});
});
You can also use it from the command line by running:
mhtml2html <path_to_mhtml_file> <output_file_path>
Include the mhtml2html script under the dist folder:
<script type="text/javascript" src="mhtml2html-${VERSION}-min.js"></script>
<script>
var reader = new FileReader();
reader.addEventListener("loadend", function() {
html = mhtml2html.parse(this.result);
// Alternatively you could convert the result directly and have
// it implicitly parsed i.e html = mhtml2html.convert(this.result);
console.log(mhtml2html.convert(html));
});
reader.readAsText(mhtmlBlob);
</script>
mhtml2html.noConflict();
mhtml2html.parse(mhtml_string, html_only = false);
{
"index" : "<html-index-url>",
"assets": {
"<asset-url>" : {
"data" : "<resource-string>",
"id": "<frame-id>",
"type": "<resource-type",
"encoding": "<resource-encoding>"
}
}
}
mhtml2html.convert(mhtml_string or mhtml_object);
To build and test mhtml2html:
npm install from the root directory../node_modules/gulp/bin/gulp.js to build the scripts and run tests.Released under the MIT License
FAQs
Converts an mhtml document to a single html document
The npm package mhtml2html receives a total of 769 weekly downloads. As such, mhtml2html popularity was classified as not 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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.