welsonjs/lib/base64.js

30 lines
919 B
JavaScript
Raw Normal View History

2020-07-07 17:06:38 +00:00
////////////////////////////////////////////////////////////////////////
// Base64 API
////////////////////////////////////////////////////////////////////////
2022-01-17 16:10:57 +00:00
//var XML = require("lib/xml");
var PS = require("lib/powershell");
2020-11-05 03:04:50 +00:00
2023-10-30 18:13:02 +00:00
function encode(sText) {
2022-01-17 16:10:57 +00:00
return PS.execScript("app\\assets\\ps1\\base64encode", [sText]).trim();
//return XML.create().createElement("base64").encode(sText, "bin.base64");
2020-07-07 17:06:38 +00:00
};
2023-10-30 18:13:02 +00:00
function decode(vCode) {
return (function(s) {
var h = "Encoded String: ";
if (s.indexOf(h) == 0) {
s = s.substring(h.length);
}
return s;
})(PS.execScript("app\\assets\\ps1\\base64decode", [vCode]).trim());
2022-01-17 16:10:57 +00:00
//return XML.create().createElement("base64").decode(vCode, "bin.base64");
2020-07-07 17:06:38 +00:00
};
2020-11-09 10:06:34 +00:00
2023-10-30 18:13:02 +00:00
exports.encode = encode;
exports.decode = decode;
exports.VERSIONINFO = "Base64 Module (base64.js) version 0.3.1";
2020-11-09 10:06:34 +00:00
exports.global = global;
exports.require = require;