2018-06-13 22:39:39 +03:00
|
|
|
'use strict';
|
|
|
|
|
2018-06-17 23:47:28 +03:00
|
|
|
import { arrayify, Arrayish } from './bytes';
|
2018-06-13 22:39:39 +03:00
|
|
|
|
|
|
|
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');
|
|
|
|
}
|