Files
NapCatQQ/.pnpm-store/v3/files/65/19894e47f6292344f73076c386df4bcbf8c7c81225adc92cf1eb87531cd2102427af181dc5965f70817fc94468bdc80d6d248dd5b545d3f6041ebe526ed421
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

25 lines
672 B
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = svg2base64;
/**
* @file svg字符串转base64编码
* @author mengke01(kekee000@gmail.com)
*/
/**
* svg字符串转base64编码
*
* @param {string} svg svg对象
* @param {string} scheme 头部
* @return {string} base64编码
*/
function svg2base64(svg) {
var scheme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'font/svg';
if (typeof btoa === 'undefined') {
return 'data:' + scheme + ';charset=utf-8;base64,' + Buffer.from(svg, 'binary').toString('base64');
}
return 'data:' + scheme + ';charset=utf-8;base64,' + btoa(svg);
}