MCPcopy Index your code
hub / github.com/smallfawn/QLScriptPublic / set

Method set

tools/env.js:38–48  ·  view source on GitHub ↗
(key, value)

Source from the content-addressed store, hash-verified

36 }
37 }
38 async set(key, value) {
39 if (!this.isNode()) return;
40 try {
41 const data = await this.fs.promises.readFile(this.bucket, "utf-8");
42 const json = JSON.parse(data);
43 json[key] = value;
44 await this.fs.promises.writeFile(this.bucket, JSON.stringify(json, null, 2));
45 } catch (e) {
46 this.log("❌ 写入bucket失败: " + e.message);
47 }
48 }
49 checkEnv(ckName) {
50 const envSplitor = ["&", "\n"];
51 let userCookie = (this.isNode() ? process.env[ckName] : "") || "";

Callers

nothing calls this directly

Calls 4

readFileMethod · 0.80
writeFileMethod · 0.80
isNodeMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected