New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

assetgraph

Package Overview
Dependencies
Maintainers
1
Versions
569
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assetgraph - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

47

lib/assets/Image.js
var util = require('util'),
child_process = require('child_process'),
fs = require('fs'),
temp = require('temp'),
_ = require('underscore'),
Canvas = require('canvas'),
passError = require('../util/passError'),
memoizeAsyncAccessor = require('../util/memoizeAsyncAccessor'),
Base = require('./Base');
require('bufferjs');
function Image(config) {

@@ -19,44 +12,6 @@ Base.call(this, config);

function makeCanvasImage(bufferOrFsPath, cb) {
var canvasImage = new Canvas.Image();
canvasImage.onerror = function (err) {
process.nextTick(function () {
cb(err);
});
};
canvasImage.onload = function () {
process.nextTick(function () {
cb(null, canvasImage);
});
};
canvasImage.src = bufferOrFsPath;
}
_.extend(Image.prototype, {
defaultEncoding: null,
getCanvasImage: memoizeAsyncAccessor('canvasImage', function (cb) {
var that = this;
this.getSerializedSrc(passError(cb, function (src) {
if (that.type === 'Png' || that.type === 'Jpeg') {
makeCanvasImage(src, cb);
} else {
// Use GraphicsMagick while waiting for gif support: https://github.com/LearnBoost/node-canvas/issues/78
var buffers = [],
convertProcess = child_process.spawn('gm', ['convert', that.type.toLowerCase() + ':-', 'png:-']);
convertProcess.stdout.on('data', function (buffer) {
buffers.push(buffer);
});
convertProcess.on('exit', function () {
makeCanvasImage(Buffer.concat(buffers), cb);
}).on('error', function (err) {console.warn("err! " + err.stack); cb(err);});
convertProcess.stdin.write(src);
convertProcess.stdin.end();
}
}));
})
defaultEncoding: null
});
module.exports = Image;

2

package.json

@@ -5,3 +5,3 @@ {

"repository": "git://github.com/One-com/assetgraph.git",
"version": "0.1.0",
"version": "0.1.1",
"maintainers": [

@@ -8,0 +8,0 @@ {

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