MCPcopy Create free account
hub / github.com/cryptii/cryptii / encodeBytes

Method encodeBytes

src/Encoder/URL.js:64–70  ·  view source on GitHub ↗

* Percent-encode bytes. * @param {Uint8Array} bytes Bytes * @return {string} URL encoded bytes

(bytes)

Source from the content-addressed store, hash-verified

62 * @return {string} URL encoded bytes
63 */
64 encodeBytes (bytes) {
65 let string = ''
66 for (let i = 0; i < bytes.length; i++) {
67 string += '%' + ('0' + bytes[i].toString(16)).slice(-2)
68 }
69 return string
70 }
71
72 /**
73 * Performs decode on given content.

Callers 1

performEncodeMethod · 0.95

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected