plugins-workspace icon indicating copy to clipboard operation
plugins-workspace copied to clipboard

[request] Recursive option for `readDir()`

Open alinnert opened this issue 8 months ago • 2 comments

Is there a chance fs.readDir() gets a recursive option?

The documentation shows how to implement your own recursive version. It works but it gets very slow very quickly because there's a frontend-backend-roundtrip for every folder that gets read.

I've implemented the same thing in Rust and transfer all paths in one go back to the frontend. It's a lot faster but it seems it still blocks the main thread. Then I've tried to add threads with the help of AI but that's where I've realized I really need to know Rust in order to implement that properly, which unfortunately I don't.

That's why I think a recursive option would be really beneficial.

alinnert avatar Apr 24 '25 23:04 alinnert

It's a lot faster but it seems it still blocks the main thread. Then I've tried to add threads with the help of AI

Did you make the command an async fn? That should prevent the freeze without requiring any complicated code changes.

FabianLars avatar Apr 25 '25 07:04 FabianLars

Oh, that was an easy fix. That works, thank you.

alinnert avatar Apr 25 '25 15:04 alinnert