public openReader( includeFileNames as Boolean = true, includeFileBytes as Boolean = false, followSymlinks as Boolean = false ) as DirectoryReader throws IOException
Opens a streaming cursor over this directory.
Unlike listNames() or list(), openReader(...) enumerates entries in bounded batches and separates subdirectories from regular files directly from OS directory metadata without materializing the full directory at once.
| Parameter | Description |
|---|---|
includeFileNames | Retain regular file names in DirectoryBatch.fileNames. |
includeFileBytes | Accumulate logical file sizes in DirectoryBatch.bytes. |
followSymlinks | Follow symbolic links instead of counting them as skipped. |
An open DirectoryReader cursor to use with try reader = folder.openReader():.
import klyn.io
try reader = Path.cwd.openReader():
batch = reader.read(256)
print(batch.folders.size)
print(batch.fileNames.size)