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

base64-image-mime

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

base64-image-mime - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

CHANGELOG.md

7

index.js
const atob = require('atob')
const Buffer = require('buffer/').Buffer
const mimeTypes = {

@@ -14,6 +15,6 @@ png: 'image/png',

function getImageMime (base64Encoded) {
function getImageMime(base64Encoded) {
if (base64Encoded.startsWith('data:')) {
const found = base64Encoded.match(/(?<=data:)\S*(?=;base64)/g)
return found && found[0]
const found = base64Encoded.match(/data:\S*;base64/g)
return found && found[0].slice('data:'.length, ';base64'.length * -1)
} else {

@@ -20,0 +21,0 @@ const prefix = atob(base64Encoded.slice(0, 60))

{
"name": "base64-image-mime",
"version": "1.0.1",
"version": "1.0.2",
"description": "Get mimetype from base64-encoded images",

@@ -29,3 +29,4 @@ "main": "index.js",

"dependencies": {
"atob": "^2.1.2"
"atob": "^2.1.2",
"buffer": "^6.0.3"
},

@@ -32,0 +33,0 @@ "devDependencies": {

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