MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / parse

Function parse

app/rcc/scripts/parser/js/base64_encoded.js:56–65  ·  view source on GitHub ↗

* Parses a Base64-encoded frame into an array of byte values. * * @param {string} frame - The Base64-encoded data from the data source * @returns {array} Array of byte values (0-255), or empty array on error

(frame)

Source from the content-addressed store, hash-verified

54 * @returns {array} Array of byte values (0-255), or empty array on error
55 */
56function parse(frame) {
57 try {
58 let binaryString = atob(frame);
59 return Array.from(binaryString).map(char => char.charCodeAt(0));
60 }
61 catch (e) {
62 console.error("Base64 decode error:", e.message);
63 return [];
64 }
65}

Callers

nothing calls this directly

Calls 2

atobFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected