Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 687 Bytes

cli-scripts-nodejs.md

File metadata and controls

33 lines (24 loc) · 687 Bytes
title tags created modified
cli-scripts-nodejs
cli
nodejs
scripts
2023-01-07 15:58:31 UTC
2023-01-07 15:59:24 UTC

cli-scripts-nodejs

guide

nodejs-scripts

// [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 });
}