17 lines
545 B
JavaScript
17 lines
545 B
JavaScript
|
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
exports.tmp = tmp;
|
||
|
const os_1 = require("os");
|
||
|
const path_1 = require("path");
|
||
|
const crypto_1 = require("crypto");
|
||
|
const TMP = (0, os_1.tmpdir)();
|
||
|
function tmp(ext = '', prefix = '3d-tmp-', fileName = null) {
|
||
|
let path = null;
|
||
|
if (fileName === null) {
|
||
|
fileName = prefix + (0, crypto_1.randomBytes)(32).toString('hex') + ext;
|
||
|
}
|
||
|
path = (0, path_1.join)(TMP, fileName);
|
||
|
return path;
|
||
|
}
|
||
|
module.exports = { tmp };
|
||
|
//# sourceMappingURL=index.js.map
|