Skip to main content

Interface: DirHandle

Directory entries can be obtained through asynchronous iteration:

const dirIter = await tjs.readDir('.');
for await (const item of dirIter) {
console.log(item.name);
}

Extends​

  • AsyncIterableIterator<DirEnt>.AsyncDisposable

Properties​

path​

path: string

Path of the directory.

Methods​

[asyncIterator]()​

[asyncIterator](): AsyncIterableIterator<DirEnt, any, any>

Returns​

AsyncIterableIterator<DirEnt, any, any>

Inherited from​

AsyncIterableIterator.[asyncIterator]


close()​

close(): Promise<void>

Closes the directory handle. Idempotent: closing an already-closed handle resolves successfully.

Aliased as Symbol.asyncDispose, so await using d = await tjs.readDir(...) closes the handle at scope exit.

Returns​

Promise<void>


next()​

next(...__namedParameters): Promise<IteratorResult<DirEnt, any>>

Parameters​

__namedParameters​

[] | [any]

Returns​

Promise<IteratorResult<DirEnt, any>>

Inherited from​

AsyncIterableIterator.next


return()?​

optional return(value?): Promise<IteratorResult<DirEnt, any>>

Parameters​

value?​

any

Returns​

Promise<IteratorResult<DirEnt, any>>

Inherited from​

AsyncIterableIterator.return


throw()?​

optional throw(e?): Promise<IteratorResult<DirEnt, any>>

Parameters​

e?​

any

Returns​

Promise<IteratorResult<DirEnt, any>>

Inherited from​

AsyncIterableIterator.throw