mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-12-14 22:54:32 +08:00
preload分割
This commit is contained in:
12
plugin/lib/getQuickcommandTempFile.js
Normal file
12
plugin/lib/getQuickcommandTempFile.js
Normal 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;
|
||||
Reference in New Issue
Block a user