redis-smq-common
Version:
Provides essential components and utilities shared across RedisSMQ packages.
25 lines • 1.11 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCacheDir = getCacheDir;
const node_os_1 = __importDefault(require("node:os"));
const path_1 = __importDefault(require("path"));
const CACHE_DIR = {
darwin: path_1.default.join(node_os_1.default.homedir(), 'Library', 'Caches'),
linux: path_1.default.join(node_os_1.default.homedir(), '.cache'),
win32: process.env.LOCALAPPDATA || path_1.default.join(node_os_1.default.homedir(), 'AppData', 'Local'),
freebsd: path_1.default.join(node_os_1.default.homedir(), '.cache'),
openbsd: path_1.default.join(node_os_1.default.homedir(), '.cache'),
android: path_1.default.join(node_os_1.default.homedir(), '.cache'),
};
function getCacheDir() {
const platform = node_os_1.default.platform();
const dir = CACHE_DIR[platform];
if (!dir) {
throw new Error(`Unsupported platform: ${platform}`);
}
return dir;
}
//# sourceMappingURL=cache-dir.js.map