A simple Node.js module for reading metadata from a base64-encoded image string.
npm install image-metadata-from-base64
const readData = require('image-metadata-from-base64');
(async () => {
// Then/Catch
readData('data:image/jpeg;base64,/9j/4QDeRXhpZgAATU0AKgAAAAgACAE...NGdm7n/2Q==')
.then(res => console.log(res))
.catch(err => console.log(err))
// Await
const data = await readData('data:image/jpeg;base64,/9j/4QDeRXhpZgAATU0AKgAAAAgACAE...NGdm7n/2Q==')
console.log(data)
})()
Note: image size is specified in kilobytes.
{ format: 'jpeg', size: 204.3671875, width: 1280, height: 720 }