MCPcopy Create free account
hub / github.com/pywebio/PyWebIO / b64toBlob

Function b64toBlob

webiojs/src/utils.ts:55–73  ·  view source on GitHub ↗
(b64Data: string, contentType = 'application/octet-stream', sliceSize = 512)

Source from the content-addressed store, hash-verified

53
54
55export function b64toBlob(b64Data: string, contentType = 'application/octet-stream', sliceSize = 512) {
56 const byteCharacters = atob(b64Data);
57 const byteArrays = [];
58
59 for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
60 const slice = byteCharacters.slice(offset, offset + sliceSize);
61
62 const byteNumbers = new Array(slice.length);
63 for (let i = 0; i < slice.length; i++) {
64 byteNumbers[i] = slice.charCodeAt(i);
65 }
66
67 const byteArray = new Uint8Array(byteNumbers);
68 byteArrays.push(byteArray);
69 }
70
71 const blob = new Blob(byteArrays, {type: contentType});
72 return blob;
73}
74
75export function make_set(arr: string[]) {
76 let set: { [i: string]: string } = {};

Callers 2

handle_messageMethod · 0.90
output.tsFile · 0.90

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…