Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async readdir() {
try {
let ret = await Plugins.Filesystem.readdir({
path: 'secrets',
directory: FilesystemDirectory.Documents
});
console.log('Read dir', ret);
} catch(e) {
console.error('Unable to read dir', e);
}
}
constructor() {
super({
name: 'Filesystem',
platforms: ['electron']
});
this.fileLocations = {DRIVE_ROOT: '', DOCUMENTS: ''};
let path = require("path");
let os = require("os");
if(os.platform == "win32" ) {
this.fileLocations["DRIVE_ROOT"] = process.cwd().split(path.sep)[0];
} else {
this.fileLocations["DRIVE_ROOT"] = '/';
}
this.fileLocations[FilesystemDirectory.Documents] = path.join(os.homedir(), `Documents`) + path.sep;
this.NodeFS = require('fs');
this.Path = path;
}