beyond
Version:
The Full Stack Universal Typescript Framework
30 lines (26 loc) • 894 B
JavaScript
const {fs} = global.utils;
const ipcManager = require('../ipc-manager');
module.exports = function () {
const code = 'b3d421';
this.validate = params => params?.hash?.toUpperCase() === code.toUpperCase();
this.cleanCache = async () => {
try {
const path = require('path').join(ipcManager.wd, '.beyond');
if (!await fs.exists(path)) return {status: true};
await fs.promises.rmdir(path, {recursive: true});
return {status: true};
}
catch (e) {
return {status: false, error: e};
}
}
this.getWD = async () => {
try {
const data = await ipcManager.getWd();
return {status: true, data: {wd: data}};
}
catch (exc) {
return {status: false, error: 'Cannot get working directory'};
}
}
}