image-convert
Advanced tools
Comparing version 0.1.305 to 0.1.306
14
index.js
@@ -6,4 +6,12 @@ // Copyright 2016 Arshpreet Wadehra | ||
const request = require('request').defaults({ encoding: null }); | ||
const base64 = require('file-base64'); | ||
const atob = require('atob'); | ||
function dataURLtoFile(dataurl, filename) { | ||
var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], | ||
bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); | ||
while(n--){ | ||
u8arr[n] = bstr.charCodeAt(n); | ||
} | ||
return new File([u8arr], filename, {type:mime}); | ||
} | ||
module.exports = { | ||
@@ -26,5 +34,3 @@ fromURL : (options, callback)=>{ | ||
buffer = image(body).size(size).encode(output_format,{quality:quality}); | ||
base64.decode(buffer,new Date()+"az."+output_format,function(err,out){ | ||
callback(null,out); | ||
}) | ||
callback(null,dataURLtoFile(buffer,new Date()+"."+output_format)); | ||
}); | ||
@@ -31,0 +37,0 @@ } |
{ | ||
"name": "image-convert", | ||
"version": "0.1.305", | ||
"version": "0.1.306", | ||
"description": "convert image to different format like gif2jpg jpg2png also manage the quality & size", | ||
@@ -25,3 +25,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"file-base64": "^1.0.0", | ||
"atob": "^2.0.3", | ||
"images": "^3.0.0", | ||
@@ -28,0 +28,0 @@ "request": "^2.79.0" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3909
39
+ Addedatob@^2.0.3
+ Addedatob@2.1.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
- Removedfile-base64@^1.0.0
- Removedcore-util-is@1.0.3(transitive)
- Removedfile-base64@1.0.0(transitive)
- Removedfrom2@2.3.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedinto-stream@2.0.1(transitive)
- Removedisarray@1.0.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)