Class Stats

Implementation of Node's Stats.

Attribute descriptions are from `man 2 stat'

Hierarchy

Implements

  • Stats

Constructors

  • Provides information about a particular entry in the file system.

    Parameters

    • itemType: FileType = FileType.FILE

      Type of the item (FILE, DIRECTORY, SYMLINK, or SOCKET)

    • size: number | bigint = -1

      Size of the item in bytes. For directories/symlinks, this is normally the size of the struct that represents the item.

    • Optional mode: number | bigint

      Unix-style file mode (e.g. 0o644)

    • Optional atimeMs: number | bigint

      time of last access, in milliseconds since epoch

    • Optional mtimeMs: number | bigint

      time of last modification, in milliseconds since epoch

    • Optional ctimeMs: number | bigint

      time of last time file status was changed, in milliseconds since epoch

    • Optional uid: number | bigint

      the id of the user that owns the file

    • Optional gid: number | bigint

      the id of the group that owns the file

    • Optional birthtimeMs: number | bigint

      time of file creation, in milliseconds since epoch

    Returns Stats

Properties

_isBigint: boolean = false
atimeMs: number
birthtimeMs: number
blksize: number = ...

blocksize for file system I/O

blocks: number
ctimeMs: number
dev: number = ...

ID of device containing file

fileData: Uint8Array = null

Some file systems stash data on stats objects.

gid: number = ...

group ID of owner

ino: number = ...

inode number

mode: number
mtimeMs: number
nlink: number = ...

number of hard links

rdev: number = ...

device ID (if special file)

size: number
uid: number = ...

user ID of owner

Accessors

  • get _typename(): string
  • Returns string

  • get _typename_inverse(): string
  • Returns string

  • get atime(): Date
  • Returns Date

  • get birthtime(): Date
  • Returns Date

  • get ctime(): Date
  • Returns Date

  • get mtime(): Date
  • Returns Date

Methods

  • Change the mode of the file. We use this helper function to prevent messing up the type of the file, which is encoded in mode.

    Parameters

    • mode: number

    Returns void

  • Change the owner user/group of the file. This function makes sure it is a valid UID/GID (that is, a 32 unsigned int)

    Parameters

    • uid: number | bigint
    • gid: number | bigint

    Returns void

  • Checks if a given user/group has access to this item

    Parameters

    • mode: number

      The request access as 4 bits (unused, read, write, execute)

    • cred: Cred

    Returns boolean

    [Boolean] True if the request has access, false if the request does not

  • Returns boolean

    [Boolean] True if this item is a directory.

  • Returns boolean

    [Boolean] True if this item is a file.

  • Returns boolean

    [Boolean] True if this item is a symbolic link (only valid through lstat)

Generated using TypeDoc