Path.iterdirStreamSync() method
pathlib-ts > Path > iterdirStreamSync
Path.iterdirStreamSync() method
Section titled “Path.iterdirStreamSync() method”Streams directory entries synchronously using generators.
Signature:
iterdirStreamSync(options?: { extra?: { withFileTypes?: false; }; }): Iterable<Path>;Parameters
Section titled “Parameters”|
Parameter |
Type |
Description |
|---|---|---|
|
options |
{ extra?: { withFileTypes?: false; }; } |
(Optional) Optional flags controlling the yielded value type. |
Returns:
Iterable<Path>
An iterable emitting Path objects or Dirents.
Exceptions
Section titled “Exceptions”The UnsupportedOperation When requesting withFileTypes without runtime support.
Remarks
Section titled “Remarks”Prefers fs.opendirSync for efficient iteration and falls back to fs.readdirSync.
Example
Section titled “Example”Iterating lazily in synchronous tooling
import { Path } from "pathlib-ts";
const fixtures = new Path("./tests/fixtures");for (const entry of fixtures.iterdirStreamSync()) { console.log(entry.toString());}