seperate regular
This commit is contained in:
@@ -36,10 +36,12 @@ class Store {
|
||||
|
||||
class HTML {
|
||||
html: string;
|
||||
constructor() {
|
||||
filename: string;
|
||||
constructor(filename: string) {
|
||||
this.filename = filename;
|
||||
// load from file
|
||||
try {
|
||||
this.html = fs.readFileSync("./html.html", "utf8");
|
||||
this.html = fs.readFileSync(this.filename, "utf8");
|
||||
} catch {
|
||||
this.html = "";
|
||||
}
|
||||
@@ -50,10 +52,11 @@ class HTML {
|
||||
public async set(html: string) {
|
||||
this.html = html;
|
||||
// store into file
|
||||
await write("./html.html", html, "utf8");
|
||||
await write(this.filename, html, "utf8");
|
||||
}
|
||||
}
|
||||
|
||||
export const html = new HTML();
|
||||
export const store = new Store("store.json");
|
||||
export const regular = new Store("regular.json");
|
||||
export const html = new HTML("./data/html.html");
|
||||
export const htmlRegular = new HTML("./data/html-regular.html");
|
||||
export const store = new Store("./data/store.json");
|
||||
export const regular = new Store("./data/regular.json");
|
||||
|
||||
Reference in New Issue
Block a user