Drop TextEncoder requirement
See original GitHub issueThe need for TextEncoder is limited and it is not supported (without expensive polyfills) on IE or Edge.
It is easily replaced as follows:
// modified from source: http://stackoverflow.com/a/11058858
export function str2ab(str: string) {
const buf = new ArrayBuffer(str.length);
const bufView = new Uint8Array(buf);
for (let i = 0; i < str.length; i++) {
bufView[i] = str.charCodeAt(i);
}
return buf;
}
crypto.subtle.digest('SHA-256', str2ab(code))
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Add support for TextEncoder and TextDecoder #2524 - GitHub
There is no plan to stop requiring the latest Node.js releases in the new major versions. You can use the old unsupported versions...
Read more >TextDecoder TextEncoder feature detection in javascript
Is there any drop in libraries that would pollyfill? And if it does not exist can I conditionally load a pollyfill. I do...
Read more >TextEncoder - Web APIs - MDN Web Docs
Chrome Edge
TextEncoder Full support. Chrome38. Toggle history Full support. Edge79. To...
TextEncoder() constructor Full support. Chrome38. Toggle history Full support. Edge79. To...
encode Full support....
Read more >TextEncoder is not defined | NodeJs | MongoDB | Solved
TextEncoder is not definedReference ErrorPath for required filenode_modules/whatwg-url/encoding.jsThanks# TextEncoder #mongodb #nodejs.
Read more >The Plug and Play of Language Models for Text-to-image ...
Without the finetuning step, performance actually drops. Therefore it is not strictly “plug and play” of the new text encoder and the MTN....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry about the delay. Have been swamped with a lot of other things.
AppAuth-JS 1.1.2 is now live. https://www.npmjs.com/package/@openid/appauth
Now uses TypeScript 3.2.1.
OK great. Let us know when it is available 😃