MCPcopy Create free account
hub / github.com/nodejs/node / toBase64

Function toBase64

test/fixtures/wpt/url/percent-encoding.window.js:28–33  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

26// not use btoa directly as that only works with code points in the range U+0000 to U+00FF,
27// inclusive.
28function toBase64(input) {
29 const bytes = new TextEncoder().encode(input);
30 const byteString = Array.from(bytes, byte => String.fromCharCode(byte)).join("");
31 const encoded = self.btoa(byteString);
32 return encoded;
33}

Callers 1

runTestsFunction · 0.85

Calls 4

encodeMethod · 0.80
btoaMethod · 0.80
joinMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected