Skip to content

Add bounded isEmptyDir checks - #1085

Draft
Victor-Su-Ortiz wants to merge 1 commit into
jprichardson:masterfrom
Victor-Su-Ortiz:minimax/is-empty-dir-1037
Draft

Victor-Su-Ortiz wants to merge 1 commit into
jprichardson:masterfrom
Victor-Su-Ortiz:minimax/is-empty-dir-1037

Conversation

@Victor-Su-Ortiz

Copy link
Copy Markdown

Summary

Fixes #1037.

Add isEmptyDir (promise/callback) and isEmptyDirSync, exported through the CommonJS and ESM entry points. Both use opendir and read a single entry, then close the handle. Filesystem errors are preserved, including a read error if closing also fails.

Includes API documentation and tests for empty/nonempty directories, missing paths, files, symlinks, bounded reads, and cleanup.

Verification

  • The public API regression tests fail on the original exports and pass with the change.
  • Focused suite: 15 passing.
  • npm test: lint, 760 CommonJS tests, and ESM tests pass; 8 existing tests pending. Cross-device tests were not enabled.
  • git diff --check: passed.

Verified locally on macOS; other platforms remain for CI.

AI assistance

Implementation and initial tests were produced through OpenCode using opencode/space-bunny-free (Space Bunny). Codex reviewed the diff and independently ran the checks above. This draft has not received human code review.

@RyanZim

RyanZim commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Please undraft once you've reviewed this yourself and this PR is ready for review. From a quick cursory look, this PR could use some cleanup.

Going forward, I'd prefer if PRs were opened only after you've given the code a human review. But thanks for being transparent and upfront about the AI usage and status of the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: isEmptyDir()

2 participants