feat: utilities - cache

This commit is contained in:
Nick
2019-07-06 17:06:42 -04:00
parent 13f172978f
commit dc4fa9b31e
10 changed files with 126 additions and 11 deletions

View File

@@ -164,4 +164,8 @@ module.exports = class Asset extends Model {
res.sendStatus(404)
}
}
static async flushTempUploads() {
return fs.emptyDir(path.join(process.cwd(), `data/uploads`))
}
}

View File

@@ -417,6 +417,10 @@ module.exports = class Page extends Model {
return fs.remove(path.join(process.cwd(), `data/cache/${page.hash}.bin`))
}
static async flushCache() {
return fs.emptyDir(path.join(process.cwd(), `data/cache`))
}
static cleanHTML(rawHTML = '') {
return striptags(rawHTML || '')
.replace(emojiRegex(), '')