Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node:fs/promises - opendir does not respect recursive option. #13717

Closed
justinweinberg opened this issue Sep 3, 2024 · 2 comments
Closed

node:fs/promises - opendir does not respect recursive option. #13717

justinweinberg opened this issue Sep 3, 2024 · 2 comments
Labels
bug Something isn't working node:fs

Comments

@justinweinberg
Copy link

What version of Bun is running?

1.1.26+0a37423ba

What platform is your computer?

Darwin 23.6.0 arm64 arm

What steps can reproduce the bug?

The following code in bun does not recurse subdirectories. It does in Node. Paste into an index.ts.

import { opendir } from 'node:fs/promises';

async function* list(path: string, deep: boolean) {
  const entries = await opendir(path, {
    recursive: deep,
  });

  for await (const item of entries) {
    yield item;
  }
}

async function go() {
  let count = 0;
  for await (let i of list("./", true)) {
    count += 1;
  }
  return count;
}

What is the expected behavior?

node --experimental-strip-types index.ts
3

bun index.ts
2

What do you see instead?

NodeJS returns the recursive result, in my case 3. Bun does not, in my case 2.

Additional information

No response

@justinweinberg justinweinberg added bug Something isn't working needs triage labels Sep 3, 2024
@sylv
Copy link

sylv commented Nov 28, 2024

This not producing an obvious error makes it more problematic imo, it would be nice to have the option being present cause an error/warning until its implemented

@dylan-conway
Copy link
Member

Fixed in Bun v1.2.0 with #16422

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node:fs
Projects
None yet
Development

No branches or pull requests

3 participants