A set of functions for manipuliating data URIs.
$ npm install data-uri-utils --save
const dataUri = require('data-uri-utils')
const uri = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='
dataUri.normalize(uri)
dataUri.toBuffer(uri).byteLength // => 89
dataUri.test(uri) // => true
dataUri.exec(uri)[2] // => 'image/png'
data-uri-utils © Kiko Beats, released under the MIT License.
Authored and maintained by Kiko Beats with help from contributors.
kikobeats.com · GitHub Kiko Beats · Twitter @Kikobeats