Skip to main content
Version: Next

FileInfo

type FileInfo = object;

File information, it contains 3 groups of properties:

  • Common properties that are available for all platforms.
  • Windows platforms only properties
  • Unix platforms only properties

Common​

accessed?​

optional accessed?: Date;

Last access time of the file.

The value can be undefined if failed to get this information.


created?​

optional created?: Date;

Creation time of the file.

The value can be undefined if failed to get this information.


isDir​

isDir: boolean;

Whether the file is a directory. This value is mutually exclusive to isFile.


isFile​

isFile: boolean;

Whether the file is a regular file. This value is mutually exclusive to isDir.


isSymlink: boolean;

Whether the file is a symbolic link.


len​

len: number;

The size of the file in bytes.


modified?​

optional modified?: Date;

Last modification time of the file.

The value can be undefined if failed to get this information.


readOnly​

readOnly: boolean;

Whether the file is read-only (unwritable).

Unix Only​

atime?​

optional atime?: number;

Last access time of the file, in seconds since Unix Epoch.


atimeNsec?​

optional atimeNsec?: number;

Last access time of the file, in nanoseconds since atime.


blksize?​

optional blksize?: number;

The block size for filesystem IO.


blocks?​

optional blocks?: number;

The number of blocks allocated to the file, in 512-byte units.

Please note that this may be smaller than st_size / 512 when the file has holes.


ctime?​

optional ctime?: number;

Last status change time of the file, in seconds since Unix Epoch.


ctimeNsec?​

optional ctimeNsec?: number;

Last status change time of the file, in nanoseconds since ctime.


dev?​

optional dev?: number;

The ID of the device containing the file.


gid?​

optional gid?: number;

The group ID of the owner of the file.


ino?​

optional ino?: number;

The inode number.


mode?​

optional mode?: number;

The rights applied to the file.


mtime?​

optional mtime?: number;

Last modification time of the file, in seconds since Unix Epoch.


mtimeNsec?​

optional mtimeNsec?: number;

Last modification time of the file, in nanoseconds since mtime.


optional nlink?: number;

The number of hard links pointing to the file.


rdev?​

optional rdev?: number;

The device ID of the file (if it is a special one).


size?​

optional size?: number;

The total size of the file in bytes.


uid?​

optional uid?: number;

The user ID of the owner of the file.

Windows Only​

creationTime?​

optional creationTime?: number;

The ftCreationTime value of the file.

The value is equivalent to a FILETIME struct, which represents the number of 100-nanosecond intervals since January 1, 1601 (UTC).


fileAttributes?​

optional fileAttributes?: number;

The dwFileAttributes value of the file.

For possible values and their descriptions, see File Attribute Constants in the Windows Dev Center.


fileSize?​

optional fileSize?: number;

The nFileSize value of the file.

The value doesn't have meaning for directories.


lastAccessTime?​

optional lastAccessTime?: number;

The ftLastAccessTime value of the file.

The value is equivalent to a FILETIME struct, which represents the number of 100-nanosecond intervals since January 1, 1601 (UTC).


lastWriteTime?​

optional lastWriteTime?: number;

The ftLastWriteTime value of the file.

The value is equivalent to a FILETIME struct, which represents the number of 100-nanosecond intervals since January 1, 1601 (UTC).