@rg-dev/stdlib 1.0.38 → 1.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/node-env.cjs +8 -1
- package/lib/node-env.js +8 -1
- package/package.json +1 -1
package/lib/node-env.cjs
CHANGED
|
@@ -353,13 +353,20 @@ async function checkIfDirExistsOrThrow(path2) {
|
|
|
353
353
|
function createTempDir() {
|
|
354
354
|
const tmpDir = import_os.default.tmpdir();
|
|
355
355
|
const timestamp = Date.now();
|
|
356
|
-
const tempDirName = `temp_dir_${timestamp}`;
|
|
356
|
+
const tempDirName = `temp_dir_${timestamp}_${Math.random().toString(36).slice(2)}`;
|
|
357
357
|
const tempDirPath = import_path.default.join(tmpDir, tempDirName);
|
|
358
358
|
console.log("tempDir", tempDirPath);
|
|
359
359
|
fs.mkdirSync(tempDirPath);
|
|
360
360
|
return tempDirPath;
|
|
361
361
|
}
|
|
362
362
|
function createTempFilePath(ext) {
|
|
363
|
+
if (typeof ext == "string") {
|
|
364
|
+
if (ext.startsWith(".")) {
|
|
365
|
+
ext = ext.slice(1);
|
|
366
|
+
}
|
|
367
|
+
} else {
|
|
368
|
+
ext = void 0;
|
|
369
|
+
}
|
|
363
370
|
const name = `temp_file_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2)}${ext ? `.${ext}` : ""}`;
|
|
364
371
|
const fullPath = import_path.default.join(import_os.default.tmpdir(), name);
|
|
365
372
|
return {
|
package/lib/node-env.js
CHANGED
|
@@ -340,13 +340,20 @@ async function checkIfDirExistsOrThrow(path2) {
|
|
|
340
340
|
function createTempDir() {
|
|
341
341
|
const tmpDir = os.tmpdir();
|
|
342
342
|
const timestamp = Date.now();
|
|
343
|
-
const tempDirName = `temp_dir_${timestamp}`;
|
|
343
|
+
const tempDirName = `temp_dir_${timestamp}_${Math.random().toString(36).slice(2)}`;
|
|
344
344
|
const tempDirPath = path.join(tmpDir, tempDirName);
|
|
345
345
|
console.log("tempDir", tempDirPath);
|
|
346
346
|
fs.mkdirSync(tempDirPath);
|
|
347
347
|
return tempDirPath;
|
|
348
348
|
}
|
|
349
349
|
function createTempFilePath(ext) {
|
|
350
|
+
if (typeof ext == "string") {
|
|
351
|
+
if (ext.startsWith(".")) {
|
|
352
|
+
ext = ext.slice(1);
|
|
353
|
+
}
|
|
354
|
+
} else {
|
|
355
|
+
ext = void 0;
|
|
356
|
+
}
|
|
350
357
|
const name = `temp_file_${process.pid}_${Date.now()}_${Math.random().toString(36).slice(2)}${ext ? `.${ext}` : ""}`;
|
|
351
358
|
const fullPath = path.join(os.tmpdir(), name);
|
|
352
359
|
return {
|