diff --git a/src/emulation/dir.ts b/src/emulation/dir.ts index c606914e..75790852 100644 --- a/src/emulation/dir.ts +++ b/src/emulation/dir.ts @@ -47,7 +47,7 @@ export class Dirent implements _Dirent { /** * A class representing a directory stream. */ -export class Dir implements _Dir { +export class Dir implements _Dir, AsyncIterator { protected closed = false; protected checkClosed(): void { @@ -132,7 +132,11 @@ export class Dir implements _Dir { /** * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read. */ - public [Symbol.asyncIterator](): AsyncIterableIterator { + public [Symbol.asyncIterator](): this { return this; } + + public [Symbol.asyncDispose]() { + return Promise.resolve(); + } }