(s)
| 5440 | // Converts a string of base64 into a byte array. |
| 5441 | // Throws error on invalid input. |
| 5442 | function intArrayFromBase64(s) { |
| 5443 | if (typeof ENVIRONMENT_IS_NODE === 'boolean' && ENVIRONMENT_IS_NODE) { |
| 5444 | var buf; |
| 5445 | try { |
| 5446 | buf = Buffer.from(s, 'base64'); |
| 5447 | } catch (_) { |
| 5448 | buf = new Buffer(s, 'base64'); |
| 5449 | } |
| 5450 | return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); |
| 5451 | } |
| 5452 | |
| 5453 | try { |
| 5454 | var decoded = decodeBase64(s); |
| 5455 | var bytes = new Uint8Array(decoded.length); |
| 5456 | for (var i = 0 ; i < decoded.length ; ++i) { |
| 5457 | bytes[i] = decoded.charCodeAt(i); |
| 5458 | } |
| 5459 | return bytes; |
| 5460 | } catch (_) { |
| 5461 | throw new Error('Converting base64 string to bytes failed.'); |
| 5462 | } |
| 5463 | } |
| 5464 | |
| 5465 | // If filename is a base64 data URI, parses and returns data (Buffer on node, |
| 5466 | // Uint8Array otherwise). If filename is not a base64 data URI, returns undefined. |
no outgoing calls
no test coverage detected
searching dependent graphs…