Class StatsCommon<T>Abstract

Provides information about a particular entry in the file system. Common code used by both Stats and BigIntStats.

Type Parameters

  • T extends number | bigint

Hierarchy (view full)

Implements

Constructors

  • Creates a new stats instance from a stats-like object. Can be used to copy stats (note)

    Type Parameters

    • T extends number | bigint

    Parameters

    • __namedParameters: Partial<StatsLike<number | bigint>> = {}

    Returns StatsCommon<T>

Properties

_isBigint: T extends bigint
    ? true
    : false
atimeMs: T

time of last access, in milliseconds since epoch

birthtimeMs: T

time of file creation, in milliseconds since epoch

blksize: T = ...

blocksize for file system I/O

ctimeMs: T

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

dev: T = ...

ID of device containing file

fileData?: Uint8Array

Some file systems stash data on stats objects.

gid: T = ...

group ID of owner

ino: T = ...

inode number

mode: T

Unix-style file mode (e.g. 0o644) that includes the type of the item. Type of the item can be FILE, DIRECTORY, SYMLINK, or SOCKET

mtimeMs: T

time of last modification, in milliseconds since epoch

nlink: T = ...

number of hard links

rdev: T = ...

device ID (if special file)

size: T

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

uid: T = ...

user ID of owner

Accessors

  • get atime(): Date
  • Returns Date

  • set atime(value): void
  • Parameters

    • value: Date

    Returns void

  • get birthtime(): Date
  • Returns Date

  • set birthtime(value): void
  • Parameters

    • value: Date

    Returns void

  • get blocks(): T
  • Returns T

  • get ctime(): Date
  • Returns Date

  • set ctime(value): void
  • Parameters

    • value: Date

    Returns void

  • get mtime(): Date
  • Returns Date

  • set mtime(value): void
  • Parameters

    • value: Date

    Returns void

Methods

  • Parameters

    • arg: string | number | bigint | boolean

    Returns T

  • Internal

    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

  • Internal

    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

  • Internal

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

    Parameters

    • mode: number

      The requested access, combination of W_OK, R_OK, and X_OK

    • cred: Credentials

      The requesting credentials

    Returns boolean

    True if the request has access, false if the request does not

  • Returns boolean

  • Returns boolean

  • Returns boolean

    True if this item is a directory.

  • Returns boolean

  • Returns boolean

    true if this item is a file.

  • Returns boolean

  • Returns boolean

    true if this item is a symbolic link