Parser API for base64 data

Signed-off-by: Fabio José <fabiojose@gmail.com>
This commit is contained in:
Fabio José 2019-08-06 11:10:00 -03:00
parent 08996aeafc
commit f0ad61acd7
1 changed files with 15 additions and 0 deletions

15
lib/formats/base64.js Normal file
View File

@ -0,0 +1,15 @@
function Parser(decorator) {
this.decorator = decorator;
}
Parser.prototype.parse = function(payload) {
let toparse = payload;
if(this.decorator){
toparse = this.decorator.parse(payload);
}
return Buffer.from(toparse, "base64").toString();
};
module.exports = Parser;