2022-09-09 06:21:08 +03:00
|
|
|
import { getBytes, getBytesCopy } from "./data.js";
|
2022-09-05 23:14:43 +03:00
|
|
|
|
|
|
|
import type { BytesLike } from "./data.js";
|
|
|
|
|
|
|
|
|
|
|
|
export function decodeBase64(textData: string): Uint8Array {
|
2022-09-09 06:21:08 +03:00
|
|
|
return getBytesCopy(Buffer.from(textData, "base64"));
|
2022-09-05 23:14:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
export function encodeBase64(data: BytesLike): string {
|
2022-09-09 06:21:08 +03:00
|
|
|
return Buffer.from(getBytes(data)).toString("base64");
|
2022-09-05 23:14:43 +03:00
|
|
|
}
|