Object built-in object

Object Stat

Basic information object

Stat object passed fs.stat, File.stat, fs.readdir Query, cannot be created independently

Inheritance

#lineWidth: 1.5 #font: Helvetica,sans-Serif #fontSize: 10 #leading: 1.6 #.this: fill=lightgray #.class: fill=white [<class>object|toString();toJSON()] [<this>Stat|name;dev;ino;mode;nlink;uid;gid;rdev;size;blksize;blocks;mtime;mtimeMs;atime;atimeMs;ctime;ctimeMs;birthtime;birthtimeMs|isWritable();isReadable();isExecutable();isHidden();isBlockDevice();isCharacterDevice();isDirectory();isFIFO();isFile();isSymbolicLink();isMemory();isSocket()] [object] <:- [Stat] Stat name dev ino mode nlink uid gid rdev size blksize blocks mtime mtimeMs atime atimeMs ctime ctimeMs birthtime birthtimeMs isWritable() isReadable() isExecutable() isHidden() isBlockDevice() isCharacterDevice() isDirectory() isFIFO() isFile() isSymbolicLink() isMemory() isSocket() object toString() toJSON()

Member attributes

name

String, file name

1
readonly String Stat.name;

dev

Integer, the device ID that contains 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, the last modification time of the file

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, Is true to have write permission

isReadable

Check whether the file has read permission

1
Boolean Stat.isReadable();

Return result:

  • Boolean, If it is true, it has read permission

isExecutable

Query 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

isBlockDevice

Query whether Stat describes a block device

1
Boolean Stat.isBlockDevice();

Return result:

  • Boolean, True means a block device is described

isCharacterDevice

Query whether Stat describes a character device

1
Boolean Stat.isCharacterDevice();

Return result:

  • Boolean, True means a character device is described

isDirectory

Query whether the file is a directory

1
Boolean Stat.isDirectory();

Return result:

  • Boolean, True is the directory

isFIFO

Query whether Stat describes a FIFO pipe

1
Boolean Stat.isFIFO();

Return result:

  • Boolean, True means that a FIFO pipeline is described

isFile

Check whether the file is a file

1
Boolean Stat.isFile();

Return result:

  • Boolean, True is the 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, True is the memory file

isSocket

Check if the file is 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