ethers.js/src.ts/utils/base64.ts
2018-06-17 16:47:28 -04:00

19 lines
486 B
TypeScript

'use strict';
import { arrayify, Arrayish } from './bytes';
declare class Buffer implements ArrayLike<number> {
constructor(data: any, encoding?: string);
toString(encoding?: string): any;
[key: number]: number;
length: number;
}
export function decode(textData: string): Uint8Array {
return arrayify(new Uint8Array(new Buffer(textData, 'base64')));
};
export function encode(data: Arrayish): string {
return new Buffer(arrayify(data)).toString('base64');
}