UNPKG

igir

Version:

🕹 A zero-setup ROM collection manager that sorts, filters, extracts or archives, patches, and reports on collections of any size on any OS.

26 lines (25 loc) • 773 B
import os from 'node:os'; import path from 'node:path'; import moment from 'moment'; import FsPoly from '../polyfill/fsPoly.js'; import Package from './package.js'; /** * A static class of constants for temp directories, to be used widely. */ export default class Temp { // Note: this default path is explicitly not created immediately in case it gets changed by CLI // options static globalTempDir = path.join(os.tmpdir(), Package.NAME, moment().format('YYYYMMDD-HHmmss')); static getTempDir() { return this.globalTempDir; } static setTempDir(globalTempDir) { this.globalTempDir = globalTempDir; } } process.once('exit', () => { FsPoly.rmSync(Temp.getTempDir(), { force: true, recursive: true, }); });