@mamodesaebsaad/image-to-base64
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -16,2 +16,5 @@ /** | ||
} | ||
else if (file.type === "gif") { | ||
base64String = base64String.replace("data:image/gif;base64,", ""); | ||
} | ||
else { | ||
@@ -36,2 +39,3 @@ base64String = base64String.replace(/^data:image\/(png|jpg|jpeg|webp);base64,/, ""); | ||
let svgfileType = "data:image/svg+xml;base64,"; | ||
let gifFileType = "data:image/gif;base64,"; | ||
let image = ""; | ||
@@ -41,2 +45,5 @@ if (file === "svg") { | ||
} | ||
else if (file === "gif") { | ||
image = gifFileType + base64String; | ||
} | ||
else { | ||
@@ -43,0 +50,0 @@ image = imageFiletype + base64String; |
{ | ||
"name": "@mamodesaebsaad/image-to-base64", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Conversion of image to base64 and vice-versa", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
### Image To base64 convertor | ||
This package convert images of type png, jpg, jpeg and svg to base64 and vice versa (converts base64 to image format) | ||
This package convert images of type png, jpg, jpeg, svg and gif to base64 and vice versa (converts base64 to image format) | ||
@@ -4,0 +4,0 @@ ### Instructions |
@@ -17,2 +17,5 @@ | ||
} | ||
else if (file.type === "gif"){ | ||
base64String = base64String.replace("data:image/gif;base64,", ""); | ||
} | ||
else { | ||
@@ -39,2 +42,3 @@ base64String = base64String.replace(/^data:image\/(png|jpg|jpeg|webp);base64,/, ""); | ||
let svgfileType = "data:image/svg+xml;base64,"; | ||
let gifFileType = "data:image/gif;base64,"; | ||
let image = ""; | ||
@@ -44,2 +48,5 @@ if(file === "svg"){ | ||
} | ||
else if(file === "gif"){ | ||
image = gifFileType + base64String; | ||
} | ||
else{ | ||
@@ -46,0 +53,0 @@ image = imageFiletype + base64String; |
Sorry, the diff of this file is not supported yet
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
21075
220