emscripten-core / emscripten-core/emscripten

Simplify decodeBase64 polyfill if drop IE9?

Open
#15,518 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 6h
Merged PRs (30d)
109

Description

As I understand this original part of `decodeBase64` polyfill was written 11 years ago:
https://github.com/emscripten-core/emscripten/blob/4a9d5ab94f66b629b99c1104663bedbc80f799c1/src/base64Utils.js#L11

Nowadays it could be simplify to this:
```js
var decodeBase64 = typeof window !== 'undefined' && typeof atob === 'function' ? atob : function (input) {
return Buffer.from(input, 'base64').toString('binary');
}
```
It always forces to use `Buffer` for node.js where `atob` didn't exist before v16.0.0 but still not recommend. For the rest platforms: all browsers and Deno `atob` present for a long time. Only exception is IE 6, 7, 8 and 9. And here the question is, are you still going to support IE9?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.