Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

electron-html-to

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-html-to - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

23

lib/scripts/registerProtocol.js

@@ -5,3 +5,6 @@ /* eslint no-var: [0] */

var CUSTOM_PROTOCOL = 'electron-html-to';
var path = require('path'),
fs = require('fs'),
mime = require('mime-types'),
CUSTOM_PROTOCOL = 'electron-html-to';

@@ -26,4 +29,5 @@ function isURLEncoded(url) {

protocol.registerFileProtocol(CUSTOM_PROTOCOL, function (request, callback) {
var url = request.url.substr(CUSTOM_PROTOCOL.length + 3);
protocol.registerBufferProtocol(CUSTOM_PROTOCOL, function (request, callback) {
var url = request.url.substr(CUSTOM_PROTOCOL.length + 3),
mimeType;

@@ -40,4 +44,13 @@ log(CUSTOM_PROTOCOL + ' file protocol request for:', request.url);

log('handling ' + CUSTOM_PROTOCOL + ' file protocol request. response file path:', url);
callback({ path: url });
mimeType = mime.lookup(path.extname(url)) || 'text/plain';
log('handling ' + CUSTOM_PROTOCOL + ' file protocol request. response file path:', url, ', mime:', mimeType);
fs.readFile(url, function (err, buf) {
if (err) {
return callback();
}
callback({ data: buf, mimeType: mimeType });
});
}, function (registerProtocolErr) {

@@ -44,0 +57,0 @@ protocolsCompleted++;

{
"name": "electron-html-to",
"version": "1.0.1",
"version": "1.0.2",
"description": "Convert html to html/image using electron",

@@ -35,2 +35,3 @@ "main": "lib/index.js",

"lodash.pick": "3.1.0",
"mime-types": "2.1.8",
"minstache": "1.2.0",

@@ -37,0 +38,0 @@ "mkdirp": "0.5.1",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc