@@ -293,8 +293,6 @@ A class representing a directory stream.
293
293
294
294
Created by [ ` fs.opendir() ` ] [ ] , [ ` fs.opendirSync() ` ] [ ] , or [ ` fsPromises.opendir() ` ] [ ] .
295
295
296
- Example using async interation:
297
-
298
296
``` js
299
297
const fs = require (' fs' );
300
298
@@ -356,13 +354,13 @@ Subsequent reads will result in errors.
356
354
added: REPLACEME
357
355
-->
358
356
359
- * Returns: {Promise} containing {fs.Dirent}
357
+ * Returns: {Promise} containing {fs.Dirent|null }
360
358
361
359
Asynchronously read the next directory entry via readdir(3) as an
362
360
[ ` fs.Dirent ` ] [ ] .
363
361
364
- A ` Promise ` is returned that will be resolved with a [ Dirent ] [ ] after the read
365
- is completed .
362
+ After the read is completed, a ` Promise ` is returned that will be resolved with
363
+ an [ ` fs.Dirent ` ] [ ] , or ` null ` if there are no more directory entries to read .
366
364
367
365
_ Directory entries returned by this function are in no particular order as
368
366
provided by the operating system's underlying directory mechanisms._
@@ -374,12 +372,13 @@ added: REPLACEME
374
372
375
373
* ` callback ` {Function}
376
374
* ` err ` {Error}
377
- * ` dirent ` {fs.Dirent}
375
+ * ` dirent ` {fs.Dirent|null }
378
376
379
377
Asynchronously read the next directory entry via readdir(3) as an
380
378
[ ` fs.Dirent ` ] [ ] .
381
379
382
- The ` callback ` will be called with a [ Dirent] [ ] after the read is completed.
380
+ After the read is completed, the ` callback ` will be called with an
381
+ [ ` fs.Dirent ` ] [ ] , or ` null ` if there are no more directory entries to read.
383
382
384
383
_ Directory entries returned by this function are in no particular order as
385
384
provided by the operating system's underlying directory mechanisms._
@@ -389,11 +388,13 @@ provided by the operating system's underlying directory mechanisms._
389
388
added: REPLACEME
390
389
-->
391
390
392
- * Returns: {fs.Dirent}
391
+ * Returns: {fs.Dirent|null }
393
392
394
393
Synchronously read the next directory entry via readdir(3) as an
395
394
[ ` fs.Dirent ` ] [ ] .
396
395
396
+ If there are no more directory entries to read, ` null ` will be returned.
397
+
397
398
_ Directory entries returned by this function are in no particular order as
398
399
provided by the operating system's underlying directory mechanisms._
399
400
@@ -402,7 +403,15 @@ provided by the operating system's underlying directory mechanisms._
402
403
added: REPLACEME
403
404
-->
404
405
405
- * Returns: {AsyncIterator} to fully iterate over all entries in the directory.
406
+ * Returns: {AsyncIterator} of {fs.Dirent}
407
+
408
+ Asynchronously iterates over the directory via readdir(3) until all entries have
409
+ been read.
410
+
411
+ Entries returned by the async iterator are always an [ ` fs.Dirent ` ] [ ] .
412
+ The ` null ` case from ` dir.read() ` is handled internally.
413
+
414
+ See [ ` fs.Dir ` ] [ ] for an example.
406
415
407
416
_ Directory entries returned by this iterator are in no particular order as
408
417
provided by the operating system's underlying directory mechanisms._
@@ -4825,7 +4834,7 @@ and cleaning up the directory.
4825
4834
The ` encoding ` option sets the encoding for the ` path ` while opening the
4826
4835
directory and subsequent read operations.
4827
4836
4828
- Example using async interation :
4837
+ Example using async iteration :
4829
4838
4830
4839
``` js
4831
4840
const fs = require (' fs' );
0 commit comments