This commit is contained in:
smallfawn committed 2026-04-07 14:12:27 +08:00
1 parent cf0b4e9a1d
commit d07a7e867b
2 files changed
+22 -2

No files matched your search

+11 -1
View File
@@ -11,8 +11,18 @@ function Env(t, s) {
this.startTime = new Date().getTime();
Object.assign(this, s);
this.log(`\ud83d\udd14${this.name},\u5f00\u59cb!`);
this.bucket = ''
this.bucket = this.bucket || ''
this.fs = require("fs");
if (this.isNode() && this.bucket) {
try {
if (!this.fs.existsSync(this.bucket)) {
this.fs.writeFileSync(this.bucket, JSON.stringify({}, null, 2));
this.log(`📁 已创建 bucket 文件: ${this.bucket}`);
}
} catch (e) {
this.log("❌ 初始化 bucket 失败: " + e.message);
}
}
}
async get(key, def = null) {
if (!this.isNode()) return def;
+11 -1
View File
@@ -11,8 +11,18 @@ function Env(t, s) {
this.startTime = new Date().getTime();
Object.assign(this, s);
this.log(`\ud83d\udd14${this.name},\u5f00\u59cb!`);
this.bucket = ''
this.bucket = this.bucket || ''
this.fs = require("fs");
if (this.isNode() && this.bucket) {
try {
if (!this.fs.existsSync(this.bucket)) {
this.fs.writeFileSync(this.bucket, JSON.stringify({}, null, 2));
this.log(`📁 已创建 bucket 文件: ${this.bucket}`);
}
} catch (e) {
this.log("❌ 初始化 bucket 失败: " + e.message);
}
}
}
async get(key, def = null) {
if (!this.isNode()) return def;