This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// node 14 tested | |
const fs = require('fs'); | |
const os = require('os'); | |
const path = require('path'); | |
// this creates a random name directory within the OS temporary directory | |
const getWorkingPath = () => fs.mkdtempSync(`${os.tmpdir()}${path.sep}`); | |
// make sure to remove the whole path when finished | |
const removeWorkingPath = (path) => fs.rmSync(path, { recursive: true }); |