Skip to main content
Home
Works with
It is unknown whether this package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Node.js
It is unknown whether this package works with Deno
It is unknown whether this package works with Bun
It is unknown whether this package works with Browsers
JSR Score76%
Published10 months ago (0.0.9)
function emptyDirSync
emptyDirSync(dir: string | URL): void

Synchronously ensures that a directory is empty deletes the directory contents it is not empty.

If the directory does not exist, it is created. The directory itself is not deleted.

Requires --allow-read and --allow-write permissions.

Examples

Usage

import { emptyDirSync } from "@std/fs/empty-dir";

emptyDirSync("./foo");

Parameters

dir: string | URL

The path of the directory to empty, as a string or URL.

Return Type

void

A void value that returns once the directory is empty.

See

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@sigmasd/fs-with-x-runtime-walk

Import symbol

import { emptyDirSync } from "@sigmasd/fs-with-x-runtime-walk/empty-dir";
or

Import directly with a jsr specifier

import { emptyDirSync } from "jsr:@sigmasd/fs-with-x-runtime-walk/empty-dir";

Add Package

pnpm i jsr:@sigmasd/fs-with-x-runtime-walk
or (using pnpm 10.8 or older)
pnpm dlx jsr add @sigmasd/fs-with-x-runtime-walk

Import symbol

import { emptyDirSync } from "@sigmasd/fs-with-x-runtime-walk/empty-dir";

Add Package

yarn add jsr:@sigmasd/fs-with-x-runtime-walk
or (using Yarn 4.8 or older)
yarn dlx jsr add @sigmasd/fs-with-x-runtime-walk

Import symbol

import { emptyDirSync } from "@sigmasd/fs-with-x-runtime-walk/empty-dir";

Add Package

vlt install jsr:@sigmasd/fs-with-x-runtime-walk

Import symbol

import { emptyDirSync } from "@sigmasd/fs-with-x-runtime-walk/empty-dir";

Add Package

npx jsr add @sigmasd/fs-with-x-runtime-walk

Import symbol

import { emptyDirSync } from "@sigmasd/fs-with-x-runtime-walk/empty-dir";

Add Package

bunx jsr add @sigmasd/fs-with-x-runtime-walk

Import symbol

import { emptyDirSync } from "@sigmasd/fs-with-x-runtime-walk/empty-dir";