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.303 to 0.1.304

33

index.js

@@ -8,28 +8,15 @@ // Copyright 2016 Arshpreet Wadehra

module.exports = {
fromURL : ()=>{
let quality = 100,output_format="jpg",size=undefined;
let max_allowed_parameters = 5;
let min_allowed_parameters = 2;
let function_parameter_index = arguments.length - 1;
let callback = arguments[function_parameter_index];
console.log(arguments);
return;
if(arguments.length>max_allowed_parameters || arguments.length < min_allowed_parameters)
callback(new Error("Parameters Mismatch"),null);
else if(typeof arguments[0] == "function")
callback(new Error("URL REQUIRED"),null);
else if (typeof callback != "function")
return new Error("Function Required");
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];
fromURL : (options, callback)=>{
let {url, quality,output_format,size} = options;
if(url == undefined)
callback("No URL FOUND",null);
if(quality == undefined)
quality = 100
if(output_format == undefined)
output_format = "jpg"
try{
request.get(img, function (err, res, body) {
request.get(url, function (err, res, body) {
var img = image(body);
var buffer;
if(size ==undefined)//original size
if(size ==undefined || size == "original")//original size
buffer = image(body).encode(output_format,{quality:quality});

@@ -36,0 +23,0 @@ else

{
"name": "image-convert",
"version": "0.1.303",
"version": "0.1.304",
"description": "convert image and return static jpg and can resize from URL",

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

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

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

@@ -20,4 +24,20 @@ console.log(res);//img buffer

## Example
``` js
let imgConvert = require('image-convert').fromURL;
imgConvert({
url:"https://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Rotating_earth_(large).gif/200px-Rotating_earth_(large).gif",
quality: 100,//quality
output_format:"jpg",//jpg
size: "original"//defualt
},function(err,res){
if(!err)
console.log(res);//img buffer
})
```
## License
MIT
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