Dirent
Defined in: src/node/dir.ts:14
Type Parameters
Section titled “Type Parameters”Name extends string | Buffer = string
Implements
Section titled “Implements”Dirent<Name>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Dirent<
Name>():Dirent<Name>
Returns
Section titled “Returns”Dirent<Name>
Properties
Section titled “Properties”_encoding?
Section titled “_encoding?”
protectedoptional_encoding?:"buffer"|BufferEncoding|null
Defined in: src/node/dir.ts:27
Internal
protected_name:string
Defined in: src/node/dir.ts:17
_parentPath
Section titled “_parentPath”
protected_parentPath:string
Defined in: src/node/dir.ts:32
Internal
ino:
number
Defined in: src/node/dir.ts:15
type:
DirType
Defined in: src/node/dir.ts:16
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get name():
Name
Defined in: src/node/dir.ts:19
The file name that this fs.Dirent object refers to. The type of this
value is determined by the options.encoding passed to readdir or readdirSync.
v10.10.0
Returns
Section titled “Returns”Name
Implementation of
Section titled “Implementation of”_Dirent.name
parentPath
Section titled “parentPath”Get Signature
Section titled “Get Signature”get parentPath():
string
Defined in: src/node/dir.ts:34
The path to the parent directory of the file this fs.Dirent object refers to.
v20.12.0, v18.20.0
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”_Dirent.parentPath
Get Signature
Section titled “Get Signature”get path():
string
Defined in: src/node/dir.ts:41
Returns
Section titled “Returns”string
Methods
Section titled “Methods”isBlockDevice()
Section titled “isBlockDevice()”isBlockDevice():
boolean
Defined in: src/node/dir.ts:68
Returns true if the fs.Dirent object describes a block device.
Returns
Section titled “Returns”boolean
v10.10.0
Implementation of
Section titled “Implementation of”_Dirent.isBlockDevice
isCharacterDevice()
Section titled “isCharacterDevice()”isCharacterDevice():
boolean
Defined in: src/node/dir.ts:71
Returns true if the fs.Dirent object describes a character device.
Returns
Section titled “Returns”boolean
v10.10.0
Implementation of
Section titled “Implementation of”_Dirent.isCharacterDevice
isDirectory()
Section titled “isDirectory()”isDirectory():
boolean
Defined in: src/node/dir.ts:65
Returns true if the fs.Dirent object describes a file system
directory.
Returns
Section titled “Returns”boolean
v10.10.0
Implementation of
Section titled “Implementation of”_Dirent.isDirectory
isFIFO()
Section titled “isFIFO()”isFIFO():
boolean
Defined in: src/node/dir.ts:77
Returns true if the fs.Dirent object describes a first-in-first-out
(FIFO) pipe.
Returns
Section titled “Returns”boolean
v10.10.0
Implementation of
Section titled “Implementation of”_Dirent.isFIFO
isFile()
Section titled “isFile()”isFile():
boolean
Defined in: src/node/dir.ts:62
Returns true if the fs.Dirent object describes a regular file.
Returns
Section titled “Returns”boolean
v10.10.0
Implementation of
Section titled “Implementation of”_Dirent.isFile
isSocket()
Section titled “isSocket()”isSocket():
boolean
Defined in: src/node/dir.ts:80
Returns true if the fs.Dirent object describes a socket.
Returns
Section titled “Returns”boolean
v10.10.0
Implementation of
Section titled “Implementation of”_Dirent.isSocket
isSymbolicLink()
Section titled “isSymbolicLink()”isSymbolicLink():
boolean
Defined in: src/node/dir.ts:74
Returns true if the fs.Dirent object describes a symbolic link.
Returns
Section titled “Returns”boolean
v10.10.0
Implementation of
Section titled “Implementation of”_Dirent.isSymbolicLink
from()
Section titled “from()”
staticfrom(vfs,encoding?,parentPath?):Dirent<string>
Defined in: src/node/dir.ts:51
Internal
vfs.path is relative to the directory that was read,
so parentPath is resolved against it— like Node does.
Parameters
Section titled “Parameters”encoding?
Section titled “encoding?”"buffer" | BufferEncoding | null
parentPath?
Section titled “parentPath?”string = '.'
Returns
Section titled “Returns”Dirent<string>