Object built-in object

Object Stat

Basic information object

Stat objects can be fs.stat through fs.stat , File.stat , fs.readdir and cannot be created independently

Inheritance

Member attributes

name

String, file name

1
readonly String Stat.name;

dev

Integer, the device ID containing the file

1
readonly Integer Stat.dev;

ino

Integer, the number of Inodes in the file

1
readonly Integer Stat.ino;

mode

Integer, file permissions, Windows does not support this attribute

1
readonly Integer Stat.mode;

Integer, the number of hard links associated with this file

1
readonly Integer Stat.nlink;

uid

Integer, the id of the file owner

1
readonly Integer Stat.uid;

gid

Integer, the group id to which the file belongs

1
readonly Integer Stat.gid;

rdev

Integer, for a special type of file, contains the device ID of the file

1
readonly Integer Stat.rdev;

size

Number, file size

1
readonly Number Stat.size;

blksize

Integer, file system block size during I/O operations

1
readonly Integer Stat.blksize;

blocks

Integer, the number of blocks allocated to the file

1
readonly Integer Stat.blocks;

mtime

Date, file last modified time

1
readonly Date Stat.mtime;

mtimeMs

Number, file last modification time (ms)

1
readonly Number Stat.mtimeMs;

atime

Date, file last access time

1
readonly Date Stat.atime;

atimeMs

Number, file last access time (ms)

1
readonly Number Stat.atimeMs;

ctime

Date, file creation time

1
readonly Date Stat.ctime;

ctimeMs

Number, file creation time (ms)

1
readonly Number Stat.ctimeMs;

birthtime

Date, file generation time

1
readonly Date Stat.birthtime;

birthtimeMs

Number, file generation time (ms)

1
readonly Number Stat.birthtimeMs;

Member function

isWritable

Check whether the file has write permission

1
Boolean Stat.isWritable();

Return result:

  • Boolean , if true, you have write permission

isReadable

Check whether the file has read permission

1
Boolean Stat.isReadable();

Return result:

  • Boolean , if true, read permission

isExecutable

Check whether the file has execute permission

1
Boolean Stat.isExecutable();

Return result:

  • Boolean , if true, execute permission

isHidden

Check whether the file is hidden

1
Boolean Stat.isHidden();

Return result:

  • Boolean , hidden if true

isDirectory

Query whether the file is a directory

1
Boolean Stat.isDirectory();

Return result:

  • Boolean , true is the directory

isFile

Check whether the file is a file

1
Boolean Stat.isFile();

Return result:

  • Boolean , if true, it is a file

Query whether the file is a symbolic link

1
Boolean Stat.isSymbolicLink();

Return result:

  • Boolean , true is a symbolic link

isMemory

Query whether the file is a memory file

1
Boolean Stat.isMemory();

Return result:

  • Boolean , if true is the memory file

isSocket

Check whether the file is a Socket

1
Boolean Stat.isSocket();

Return result:


toString

Returns the string representation of the object, generally returns "[Native Object]", the object can be re-implemented according to its own characteristics

1
String Stat.toString();

Return result:

  • String , returns the string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object

1
Value Stat.toJSON(String key = "");

Call parameters:

  • key : String, unused

Return result:

  • Value , returns a value containing JSON serializable