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

node-pngcrush

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-pngcrush - npm Package Compare versions

Comparing version 0.1.9 to 0.2.0

bindings/darwin/x64/0.12.0/png_compress.node

74

binding.js

@@ -1,43 +0,47 @@

var fs = require("fs"),
path = require("path"),
name = "png_compress.node",
tryList, i, count, file, vars;
/**
* 0.8.0-0.8.25 : 0.8.0
* 0.9.9-0.10.13 : 0.9.9
* 0.9.2-0.9.8: 0.9.2
* 0.9.1-0.9.1: 0.9.1
* 0.9.0-0.9.0: 0.9.0
*/
vars = [
'0.8.0',
'0.9.9',
'0.12.0'
];
tryList = [
path.join(__dirname, "build", "Release", name) // build dir
];
'use strict';
for (i = 0, count = vars.length; i < count; i++) {
tryList.push(path.join(__dirname, "lib", process.platform, process.arch, vars[i], name));
function compiler(a, b) {
if (!/^(?:\d+.?)+$/.test(a) || !/^(?:\d+.?)+/.test(b)) {
return a > b;
}
var aArr = a.split('.');
var bArr = b.split('.');
var max = Math.max(aArr.length, bArr.length);
for (var i = 0; i < max; i++) {
if ((aArr[i] && !bArr[i]) || aArr[i] > bArr[i]) {
return 1;
} else if ((!aArr[i] && bArr[i]) || aArr[i] < bArr[i]) {
return -1;
}
}
return 0;
}
count = tryList.length;
for (i = 0; i < count; i++) {
file = tryList[i];
if (fs.existsSync(file)) {
try {
exports = require(file);
} catch (e) {
continue; // try next
var pkgInf = require('./package.json');
var bindingMap = pkgInf.bindingMap;
var bugUrl = pkgInf['bugs'] ? (pkgInf['bugs']['url'] || '') : '';
for ( var i in bindingMap) {
if (bindingMap.hasOwnProperty(i)) {
var target = i;
var versions = bindingMap[i];
var cur = process.versions['node'];
if (compiler(versions[0], cur) <= 0 && compiler(versions[1], cur) >= 0) {
try {
module.exports = require('./bindings/'+ process.platform + '/' + process.arch + '/' + target + '/png_compress.node');
return;
} catch ( e ) {
throw new Error('Can\'t load the addon. Issue to: ' + bugUrl + ' ' + e.stack);
}
}
break;
}
}
if (exports && exports.PngCompress) {
module.exports = exports;
} else {
throw new Error("Can't load addon.");
}
throw new Error('Can\'t load the addon. Issue to: ' + bugUrl);
{
"name": "node-pngcrush",
"version": "0.1.9",
"version": "0.2.0",
"description": "The node-pngcrush is an addon of node, as a readable/writable stream",

@@ -9,2 +9,16 @@ "main": "index.js",

},
"bindingMap": {
"0.8.0": [
"0.8.0",
"0.8.25"
],
"0.9.9": [
"0.10.0",
"0.10.99"
],
"0.12.0": [
"0.12.0",
"0.12.99"
]
},
"scripts": {

@@ -11,0 +25,0 @@ "test": "echo \"Error: no test specified\" && exit 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