SEARCH-444

- Created an api to clear the user index data folder
This commit is contained in:
Keerthi Niranjan
2017-11-21 22:14:27 +05:30
parent f2f1eb2cd6
commit 9e6a7df281
4 changed files with 36 additions and 30 deletions

View File

@@ -119,32 +119,6 @@ class Crypto {
});
});
}
/**
* Deleting the data index folder
* when the app is closed
*/
deleteFolders() {
Crypto.deleteFolderRecursive(this.dataFolder);
}
/**
* Removing all the folders and files inside the data folder
* @param location
*/
static deleteFolderRecursive(location) {
if (fs.existsSync(location)) {
fs.readdirSync(location).forEach((file) => {
let curPath = location + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) {
Crypto.deleteFolderRecursive(curPath);
} else {
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(location);
}
}
}
module.exports = Crypto;