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

image-convert

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

image-convert - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

30

index.js

@@ -8,9 +8,27 @@ // Copyright 2016 Arshpreet Wadehra

module.exports = {
fromURL : (url,size,callback)=>{
let img = url;
fromURL : ()=>{
let quality = 100,output_format="jpg",size=undefined;
let max_allowed_parameters = 5;
let min_allowed_parameters = 2;
if(arguments.length>max_allowed_parameters || arguments.length < min_allowed_parameters)
arguments[arguments.length-1](new Error("Parameters Mismatch"),null);
else if(typeof quality[0] == "function")
arguments[arguments.length-1](new Error("Parameters Mismatch"),null);
let img = arguments[0];
if(typeof quality[1] != "function")
quality = arguments[1];
if(typeof quality[2] != "function")
output_format = arguments[2];
if(typeof quality[3] != "function")
size = arguments[3];
try{
request.get(img, function (err, res, body) {
var buffer = image(body).size(size).encode("jpg");
callback(null,buffer);
});
request.get(img, function (err, res, body) {
var img = image(body);
var buffer;
if(size ==undefined)//original size
buffer = image(body).encode(output_format,{quality:quality});
else
buffer = image(body).size(size).encode(output_format,{quality:quality});
callback(null,buffer);
});
}

@@ -17,0 +35,0 @@ catch(e){

2

package.json
{
"name": "image-convert",
"version": "0.1.1",
"version": "0.1.2",
"description": "convert image and return static jpg and can resize from URL",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -12,3 +12,3 @@ # image-convert

let imgConvert = require('image-convert').fromURL;
imgConvert(<url>,<size>,function(err,res){
imgConvert(<url>,<quality[0..100]>,<output_format>,<size{integer}>,function(err,res){
if(!err)

@@ -15,0 +15,0 @@ console.log(res);//img buffer

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