-
Notifications
You must be signed in to change notification settings - Fork 12.8k
base64/hex methods missing from Uint8Array
#60612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I would argue that support in a beta version does not fully count as "two or more major browser engines." |
Yeah, you'll have to wait for this to be widely-supported first. Please open a new issue at that time |
I'll just add a simple workaround until it's widely supported: declare global {
interface Uint8ArrayConstructor {
fromBase64: (base64: string) => Uint8Array
fromHex: (hex: string) => Uint8Array
}
interface Uint8Array {
toBase64: () => string
toHex: () => string
}
} Add to I haven't added |
Seems it's now available in two major engines no? Bun supports this too. |
@aryzing Still not in V8, see this issue. I think we'll have to wait for that, as it covers most of the runtimes. |
This feature is supported in Bun, Firefox and Safari. It has exceeded the threshold for inclusion that exists for DOM APIs. It should be added. |
⚙ Compilation target
ESNext
⚙ Library
ESNext
Missing / Incorrect Definition
Uint8Array.fromBase64()
Uint8Array.fromHex()
Uint8Array.prototype.setFromBase64()
Uint8Array.prototype.setFromHex()
Uint8Array.prototype.toBase64()
Uint8Array.prototype.toHex()
These functions are implemented in stable Firefox and in the Safari Technology Preview.
Sample Code
Documentation Link
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array/toBase64
https://github.com/tc39/proposal-arraybuffer-base64
The text was updated successfully, but these errors were encountered: