src/index.js
async function eliminate(dir) {
  const stat = await lstat(dir);
  if (!stat.isDirectory()) {
    await unlink(dir);
    return;
  }
  const files = await readdir(dir);
  for (const file of files) {
    const path = join(dir, file);
    if (fs.existsSync(path)) {
      await eliminate(path);
    } else {
      await unlink(path);
    }
  }
  await rmdir(dir);
}
async function eliminate(dir) {
  const stat = await lstat(dir);
  if (!stat.isDirectory()) {
    await unlink(dir);
    return;
  }
  const files = await readdir(dir);
  for (const file of files) {
    const path = join(dir, file);
    if (fs.existsSync(path)) {
      await eliminate(path);
    } else {
      await unlink(path);
    }
  }
  await rmdir(dir);
}
async function eliminate ( dir ) { const stat = await lstat ( dir ) ; if ( ! stat . isDirectory ( ) ) { await unlink ( dir ) ; return ; } const files = await readdir ( dir ) ; for ( const file of files ) { const path = join ( dir , file ) ; if ( fs . existsSync ( path ) ) { await eliminate ( path ) ; } else { await unlink ( path ) ; } } await rmdir ( dir ) ; }
Delete directory or file
@param {String} dir The path/file to delete
Delete directory or file