UNPKG

325 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3function datauri(uri) {
4 if (!/^data\:/i.test(uri)) {
5 throw new TypeError('must begin with `data:`');
6 }
7 const [, body] = uri.split(',');
8 return {
9 body: Buffer.from(body, 'base64'),
10 };
11}
12exports.datauri = datauri;