title | tags | created | modified | |||
---|---|---|---|---|---|---|
cli-scripts-nodejs |
|
2023-01-07 15:58:31 UTC |
2023-01-07 15:59:24 UTC |
// [Why is __dirname not defined in node REPL? - Stack Overflow](https://stackoverflow.com/questions/8817423/why-is-dirname-not-defined-in-node-repl)
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(
import.meta.url);
const __dirname = dirname(__filename);
// rimraf(f, [opts], callback); On Node 14+ you can use
import fs from 'fs/promises';
async function main() {
await fs.rm(myDir, { recursive: true, force: true });
}