Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ba64

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ba64 - npm Package Compare versions

Comparing version 3.0.4 to 3.0.5

28

index.js

@@ -5,3 +5,3 @@ var fs = require("fs");

function getExt(data_url){
return data_url.split("data:image/")[1].split(";")[0];
return data_url.split("data:image/")[1].split(";")[0];
}

@@ -11,15 +11,11 @@

function getBa64Img(data_url){
return data_url.split(";base64,").pop();
return data_url.split(";base64,").pop();
}
module.exports.fs = fs;
// saves a base64 encoded image synchronously
module.exports.writeImageSync = function(file_path, data_url){
if (arguments.length < 2){
throw new Error("writeImage() requires two arguments. You have only included " + arguments.length);
}
fs.writeFileSync(file_path + "." + getExt(data_url), getBa64Img(data_url), {encoding: "base64"});
if (arguments.length < 2){
throw new Error("writeImage() requires two arguments. You have only included " + arguments.length);
}
fs.writeFileSync(file_path + "." + getExt(data_url), getBa64Img(data_url), {encoding: "base64"});
}

@@ -29,9 +25,6 @@

module.exports.writeImage = function(file_path, data_url, callback){
if (arguments.length < 3){
throw new Error("writeImage() requires three arguments. You have only included " + arguments.length);
}
fs.writeFile(file_path + "." + getExt(data_url), getBa64Img(data_url), {encoding: "base64"}, callback);
if (arguments.length < 3){
throw new Error("writeImage() requires three arguments. You have only included " + arguments.length);
}
fs.writeFile(file_path + "." + getExt(data_url), getBa64Img(data_url), {encoding: "base64"}, callback);
}

@@ -41,1 +34,2 @@

module.exports.getBa64Img = getBa64Img;
module.exports.fs = {readFile: fs.readFile, readFileSync: fs.readFileSync};
{
"name": "ba64",
"version": "3.0.4",
"version": "3.0.5",
"description": "A small npm module for saving base 64 encoded images to your file system.",

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

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