@@ -293,8 +293,6 @@ A class representing a directory stream.
293293
294294Created by [ ` fs.opendir() ` ] [ ] , [ ` fs.opendirSync() ` ] [ ] , or [ ` fsPromises.opendir() ` ] [ ] .
295295
296- Example using async interation:
297-
298296``` js
299297const fs = require (' fs' );
300298
@@ -356,13 +354,13 @@ Subsequent reads will result in errors.
356354added: REPLACEME
357355-->
358356
359- * Returns: {Promise} containing {fs.Dirent}
357+ * Returns: {Promise} containing {fs.Dirent|null }
360358
361359Asynchronously read the next directory entry via readdir(3) as an
362360[ ` fs.Dirent ` ] [ ] .
363361
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 .
366364
367365_ Directory entries returned by this function are in no particular order as
368366provided by the operating system's underlying directory mechanisms._
@@ -374,12 +372,13 @@ added: REPLACEME
374372
375373* ` callback ` {Function}
376374 * ` err ` {Error}
377- * ` dirent ` {fs.Dirent}
375+ * ` dirent ` {fs.Dirent|null }
378376
379377Asynchronously read the next directory entry via readdir(3) as an
380378[ ` fs.Dirent ` ] [ ] .
381379
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.
383382
384383_ Directory entries returned by this function are in no particular order as
385384provided by the operating system's underlying directory mechanisms._
@@ -389,11 +388,13 @@ provided by the operating system's underlying directory mechanisms._
389388added: REPLACEME
390389-->
391390
392- * Returns: {fs.Dirent}
391+ * Returns: {fs.Dirent|null }
393392
394393Synchronously read the next directory entry via readdir(3) as an
395394[ ` fs.Dirent ` ] [ ] .
396395
396+ If there are no more directory entries to read, ` null ` will be returned.
397+
397398_ Directory entries returned by this function are in no particular order as
398399provided by the operating system's underlying directory mechanisms._
399400
@@ -402,7 +403,15 @@ provided by the operating system's underlying directory mechanisms._
402403added: REPLACEME
403404-->
404405
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.
406415
407416_ Directory entries returned by this iterator are in no particular order as
408417provided by the operating system's underlying directory mechanisms._
@@ -4825,7 +4834,7 @@ and cleaning up the directory.
48254834The ` encoding ` option sets the encoding for the ` path ` while opening the
48264835directory and subsequent read operations.
48274836
4828- Example using async interation :
4837+ Example using async iteration :
48294838
48304839``` js
48314840const fs = require (' fs' );
0 commit comments