Skip to content

FileSystemManager.statSync ​

JS
    Stats | Object FileSystemManager.statSync(
        string path,
        boolean recursive)

Get the file Stats object

The synchronous version of FileSystemManager.stat

Parameters

  • string path: Path of the directory to delete

  • boolean recursive: Whether to recursively get the info of all files in the directory

Return Value

  • Stats: When recursive is false, returns a Stats object; see the table below for details

  • Object: When recursive is true and path is a directory path, returns an Object whose key is the relative path with path as the root and whose value is the Stats object corresponding to that path

Properties of Stats

PropertyTypeDescription
modestringThe file type and access permissions, corresponding to POSIX stat.st_mode
sizenumberFile size, in bytes (B)
lastAccessedTimenumberThe time the file was last accessed or executed, as a UNIX timestamp
lastModifiedTimenumberThe time the file was last modified, as a UNIX timestamp

Parameters of the captured exception

  • error: Returns the error message; see the table below for valid values

Valid values of error:

Error messageDescription
no such file or directoryThe file does not exist