Base64url for both node.js and brwser javascript. It can work with ArrayBuffer|TypedArray|Buffer
Remarks
Bowser code obtained from https://github.com/panva/jose/blob/main/src/runtime/browser/base64url.ts
Ƭ TypedArray: Int8Array
| Uint8Array
| Uint8ClampedArray
| Int16Array
| Uint16Array
| Int32Array
| Uint32Array
| Float32Array
| Float64Array
| BigInt64Array
| BigUint64Array
A TypedArray object describes an array-like view of an underlying binary data buffer.
▸ decode(base64
): Uint8Array
Base64url decoding (binary output) of base64url-encoded string
Name | Type | Description |
---|---|---|
base64 |
string |
a base64 string |
Uint8Array
a buffer or unicode string
▸ decode(base64
, stringOutput
): Uint8Array
Name | Type |
---|---|
base64 |
string |
stringOutput |
undefined |
Uint8Array
▸ decode(base64
, stringOutput
): Uint8Array
Name | Type |
---|---|
base64 |
string |
stringOutput |
false |
Uint8Array
▸ decode(base64
, stringOutput
): string
Name | Type |
---|---|
base64 |
string |
stringOutput |
true |
string
▸ decode(base64
, stringOutput
): Uint8Array
| string
Name | Type |
---|---|
base64 |
string |
stringOutput |
boolean |
Uint8Array
| string
▸ encode(input
, urlsafe?
, padding?
): string
Base64Url encoding of a buffer input or a string (UTF16 in browsers, UTF8 in node)
Name | Type | Default value | Description |
---|---|---|---|
input |
string | TypedArray | ArrayBufferLike | Buffer |
undefined |
|
urlsafe |
boolean |
false |
if true Base64 URL encoding is used ('+' and '/' are replaced by '-', '_') |
padding |
boolean |
true |
if false, padding (trailing '=') is removed |
string
a string with the base64-encoded representation of the input