Iterate over directory contents asynchronously.
(self)
| 153 | # Directory operations |
| 154 | |
| 155 | async def iterdir(self) -> AsyncGenerator[AsyncPath, None]: |
| 156 | """Iterate over directory contents asynchronously.""" |
| 157 | |
| 158 | def _iterdir() -> Iterator[Path]: |
| 159 | return self._path.iterdir() |
| 160 | |
| 161 | paths = await asyncio.to_thread(list, _iterdir()) |
| 162 | for path in paths: |
| 163 | yield self.__class__(path) |
| 164 | |
| 165 | async def glob(self, pattern: str) -> AsyncGenerator[AsyncPath, None]: |
| 166 | """Glob for paths matching pattern asynchronously.""" |