添加cookie管理页

This commit is contained in:
whyour
2021-03-16 14:46:40 +08:00
parent 99a8dc78db
commit 7f7d4d4f24
7 changed files with 279 additions and 59 deletions
+28
View File
@@ -0,0 +1,28 @@
import * as fs from 'fs';
import * as path from 'path';
export function getFileContentByName(fileName: string) {
if (fs.existsSync(fileName)) {
return fs.readFileSync(fileName, 'utf8');
}
return '';
}
export function getLastModifyFilePath(dir: string) {
let filePath = '';
if (fs.existsSync(dir)) {
const arr = fs.readdirSync(dir);
arr.forEach((item) => {
var fullpath = path.join(dir, item);
var stats = fs.statSync(fullpath);
if (stats.isFile()) {
if (stats.mtimeMs >= 0) {
filePath = fullpath;
}
}
});
}
return filePath;
}