MCPcopy Index your code
hub / github.com/TruthHun/BookStack / dataURLtoBlob

Function dataURLtoBlob

static/mind-map/mindmap.min.js:2–16  ·  view source on GitHub ↗
(dataurl)

Source from the content-addressed store, hash-verified

1//base64转换为图片blob
2function dataURLtoBlob(dataurl) {
3 var arr = dataurl.split(',');
4 //注意base64的最后面中括号和引号是不转译的
5 var _arr = arr[1].substring(0,arr[1].length-2);
6 var mime = arr[0].match(/:(.*?);/)[1],
7 bstr =atob(_arr),
8 n = bstr.length,
9 u8arr = new Uint8Array(n);
10 while (n--) {
11 u8arr[n] = bstr.charCodeAt(n);
12 }
13 return new Blob([u8arr], {
14 type: mime
15 });
16 }
17
18// 将 li 节点转换为 JSON 数据
19function li2jsonData(liNode) {

Callers 1

drawMindMapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected