2018-06-13 15:39:39 -04:00
|
|
|
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2018-06-17 16:47:28 -04:00
|
|
|
var bytes_1 = require("./bytes");
|
2018-07-30 18:59:52 -04:00
|
|
|
///////////////////////////////
|
|
|
|
/*
|
|
|
|
declare class Buffer implements ArrayLike<number> {
|
|
|
|
constructor(data: any, encoding?: string);
|
|
|
|
toString(encoding?: string): any;
|
|
|
|
[key: number]: number;
|
|
|
|
length: number;
|
|
|
|
}
|
|
|
|
*/
|
2018-06-13 15:39:39 -04:00
|
|
|
function decode(textData) {
|
2018-09-06 16:41:02 -04:00
|
|
|
return bytes_1.arrayify(new Uint8Array(Buffer.from(textData, 'base64')));
|
2018-06-13 15:39:39 -04:00
|
|
|
}
|
|
|
|
exports.decode = decode;
|
|
|
|
;
|
|
|
|
function encode(data) {
|
2018-09-06 16:41:02 -04:00
|
|
|
return Buffer.from(bytes_1.arrayify(data)).toString('base64');
|
2018-06-13 15:39:39 -04:00
|
|
|
}
|
|
|
|
exports.encode = encode;
|