1
0
Files
Skill/skills/lyxy-runner-js/scripts/get_temp_path.js
2026-02-12 17:57:05 +08:00

15 lines
436 B
JavaScript

import { tmpdir } from "os";
import { join } from "path";
export function getTempPath(extension) {
const timestamp = Date.now();
const random = Math.random().toString(36).substring(7);
return join(tmpdir(), `lyxy-runner-js-${timestamp}-${random}.${extension}`);
}
// CLI interface: accepts extension as first argument
if (import.meta.main) {
const extension = process.argv[2] || "js";
console.log(getTempPath(extension));
}