input type for toBase64

This commit is contained in:
n1073645 2020-06-25 13:40:36 +01:00
parent 4c3324aea1
commit 400189f6ad

View file

@ -5,6 +5,7 @@
*/
import Operation from "../Operation.mjs";
import Utils from "../Utils.mjs";
import {toBase64, ALPHABET_OPTIONS} from "../lib/Base64.mjs";
/**
@ -29,6 +30,11 @@ class ToBase64 extends Operation {
name: "Alphabet",
type: "editableOption",
value: ALPHABET_OPTIONS
},
{
"name": "Input",
"type": "option",
"value": ["Raw", "Hex"]
}
];
}
@ -40,6 +46,7 @@ class ToBase64 extends Operation {
*/
run(input, args) {
const alphabet = args[0];
input = Utils.strToArrayBuffer(Utils.convertToByteString(Utils.arrayBufferToStr(input), args[1]));
return toBase64(input, alphabet);
}