base64.ts 317 B

123456789101112
  1. "use strict";
  2. import { arrayify, BytesLike } from "@ethersproject/bytes";
  3. export function decode(textData: string): Uint8Array {
  4. return arrayify(new Uint8Array(Buffer.from(textData, "base64")));
  5. };
  6. export function encode(data: BytesLike): string {
  7. return Buffer.from(arrayify(data)).toString("base64");
  8. }