preload分割

This commit is contained in:
fofolee
2024-12-28 16:35:56 +08:00
parent 3ffe0d2c82
commit e1c31de4c1
9 changed files with 589 additions and 522 deletions

View File

@@ -0,0 +1,12 @@
const fs = require("fs");
const path = require("path");
const os = require("os");
const getQuickcommandTempFile = (ext, name, dir = "quickcommandTempDir") => {
if (!name) name = new Date().getTime() + (Math.random() * 10 ** 6).toFixed();
let tempDir = path.join(os.tmpdir(), dir);
if (!fs.existsSync(tempDir)) fs.mkdirSync(tempDir);
return path.join(tempDir, `${name}.${ext}`);
};
module.exports = getQuickcommandTempFile;