fs: ensure readdir() callback is only called once
This commit ensures that the readdir()
callback can only be called once when the withFileTypes
parameter is supplied.
Fixes: https://github.com/nodejs/node/issues/22778
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
commit message follows commit guidelines