node-red-contrib-filebrowser
Version:
node-red module to access network shares
25 lines (18 loc) • 407 B
JavaScript
;
const base64url = require('base64url');
function encode(path) {
if (typeof path !== 'string') {
throw new Error('Only strings can be base64-encoded');
}
return base64url(path);
}
function decode(id) {
if (typeof id !== 'string' || !id) {
throw new Error('Invalid id');
}
return base64url.decode(id);
}
module.exports = {
encode,
decode
};