Dir
Defined in: src/node/dir.ts:97
A class representing a directory stream.
Implements
Section titled “Implements”DirAsyncIterator<Dirent>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Dir(
path,context):Dir
Defined in: src/node/dir.ts:106
Parameters
Section titled “Parameters”string
context
Section titled “context”unknown
Returns
Section titled “Returns”Dir
Properties
Section titled “Properties”_entries?
Section titled “_entries?”
protectedoptional_entries?:Dirent<string>[]
Defined in: src/node/dir.ts:104
closed
Section titled “closed”
protectedclosed:boolean=false
Defined in: src/node/dir.ts:98
context
Section titled “context”
protectedreadonlycontext:unknown
Defined in: src/node/dir.ts:108
readonlypath:string
Defined in: src/node/dir.ts:107
Implementation of
Section titled “Implementation of”_Dir.path
Methods
Section titled “Methods”_read()
Section titled “_read()”
protected_read():Promise<Dirent<string> |null>
Defined in: src/node/dir.ts:141
Returns
Section titled “Returns”Promise<Dirent<string> | null>
[asyncDispose]()
Section titled “[asyncDispose]()”[asyncDispose]():
Promise<void>
Defined in: src/node/dir.ts:199
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”_Dir.[asyncDispose]
[asyncIterator]()
Section titled “[asyncIterator]()”[asyncIterator]():
this
Defined in: src/node/dir.ts:190
Asynchronously iterates over the directory via readdir(3) until all entries have been read.
Returns
Section titled “Returns”this
Implementation of
Section titled “Implementation of”_Dir.[asyncIterator]
[dispose]()
Section titled “[dispose]()”[dispose]():
void
Defined in: src/node/dir.ts:194
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”_Dir.[dispose]
checkClosed()
Section titled “checkClosed()”
protectedcheckClosed():void
Defined in: src/node/dir.ts:100
Returns
Section titled “Returns”void
close()
Section titled “close()”Call Signature
Section titled “Call Signature”close():
Promise<void>
Defined in: src/node/dir.ts:115
Asynchronously close the directory’s underlying resource handle. Subsequent reads will result in errors.
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”_Dir.close
Call Signature
Section titled “Call Signature”close(
cb):void
Defined in: src/node/dir.ts:116
Asynchronously close the directory’s underlying resource handle. Subsequent reads will result in errors.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”_Dir.close
closeSync()
Section titled “closeSync()”closeSync():
void
Defined in: src/node/dir.ts:136
Synchronously close the directory’s underlying resource handle. Subsequent reads will result in errors.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”_Dir.closeSync
next()
Section titled “next()”next():
Promise<IteratorResult<Dirent<string>,any>>
Defined in: src/node/dir.ts:177
Returns
Section titled “Returns”Promise<IteratorResult<Dirent<string>, any>>
Implementation of
Section titled “Implementation of”AsyncIterator.next
read()
Section titled “read()”Call Signature
Section titled “Call Signature”read():
Promise<Dirent<string> |null>
Defined in: src/node/dir.ts:155
Asynchronously read the next directory entry via readdir(3) as an Dirent.
After the read is completed, a value is returned that will be resolved with an Dirent, or null if there are no more directory entries to read.
Directory entries returned by this function are in no particular order as provided by the operating system’s underlying directory mechanisms.
Returns
Section titled “Returns”Promise<Dirent<string> | null>
Implementation of
Section titled “Implementation of”_Dir.read
Call Signature
Section titled “Call Signature”read(
cb):void
Defined in: src/node/dir.ts:156
Asynchronously read the next directory entry via readdir(3) as an Dirent.
After the read is completed, a value is returned that will be resolved with an Dirent, or null if there are no more directory entries to read.
Directory entries returned by this function are in no particular order as provided by the operating system’s underlying directory mechanisms.
Parameters
Section titled “Parameters”Callback<[Dirent<string> | null]>
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”_Dir.read
readSync()
Section titled “readSync()”readSync():
Dirent<string> |null
Defined in: src/node/dir.ts:170
Synchronously read the next directory entry via readdir(3) as a Dirent.
If there are no more directory entries to read, null will be returned.
Directory entries returned by this function are in no particular order as provided by the operating system’s underlying directory mechanisms.
Returns
Section titled “Returns”Dirent<string> | null
Implementation of
Section titled “Implementation of”_Dir.readSync