ethers.js/src.ts/utils/base64.ts

13 lines
339 B
TypeScript
Raw Normal View History

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 {
return getBytesCopy(Buffer.from(textData, "base64"));
2022-09-05 23:14:43 +03:00
};
export function encodeBase64(data: BytesLike): string {
return Buffer.from(getBytes(data)).toString("base64");
2022-09-05 23:14:43 +03:00
}