MCPcopy Index your code
hub / github.com/nodejs/node / atob

Function atob

lib/buffer.js:1390–1410  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

1388}
1389
1390function atob(input) {
1391 if (arguments.length === 0) {
1392 throw new ERR_MISSING_ARGS('input');
1393 }
1394
1395 const result = _atob(`${input}`);
1396
1397 switch (result) {
1398 case -2: // Invalid character
1399 throw lazyDOMException('Invalid character', 'InvalidCharacterError');
1400 case -1: // Single character remained
1401 throw lazyDOMException(
1402 'The string to be decoded is not correctly encoded.',
1403 'InvalidCharacterError');
1404 case -3: // Possible overflow
1405 // TODO(@anonrig): Throw correct error in here.
1406 throw lazyDOMException('The input causes overflow.', 'InvalidCharacterError');
1407 default:
1408 return result;
1409 }
1410}
1411
1412function isUtf8(input) {
1413 if (isTypedArray(input) || isAnyArrayBuffer(input)) {

Callers 4

mainFunction · 0.85
test-btoa-atob.jsFile · 0.85
testBtoaFunction · 0.85

Calls 1

lazyDOMExceptionFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…