排班工具
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
import fs from "fs";
|
||||
import { MongoClient } from "mongodb";
|
||||
import util from "util";
|
||||
|
||||
const write = util.promisify(fs.writeFile);
|
||||
const read = util.promisify(fs.readFile);
|
||||
|
||||
class Store {
|
||||
record: Record<string, string>;
|
||||
constructor() {
|
||||
@@ -27,13 +34,20 @@ class Store {
|
||||
class HTML {
|
||||
html: string;
|
||||
constructor() {
|
||||
this.html = "";
|
||||
// load from file
|
||||
try {
|
||||
this.html = fs.readFileSync("./html.html", "utf8");
|
||||
} catch {
|
||||
this.html = "";
|
||||
}
|
||||
}
|
||||
public get() {
|
||||
return this.html;
|
||||
}
|
||||
public set(html) {
|
||||
public async set(html: string) {
|
||||
this.html = html;
|
||||
// store into file
|
||||
await write("./html.html", html, "utf8");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user