Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Stats

Emulation of Node's fs.Stats object.

Attribute descriptions are from `man 2 stat'

see

http://nodejs.org/api/fs.html#fs_class_fs_stats

see

http://man7.org/linux/man-pages/man2/stat.2.html

Hierarchy

  • Stats

Implements

  • Stats

Index

Constructors

constructor

  • new Stats(itemType: FileType, size: number, mode?: undefined | number, atime?: Date, mtime?: Date, ctime?: Date): Stats
  • Provides information about a particular entry in the file system.

    Parameters

    • itemType: FileType
    • size: number

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

    • Optional mode: undefined | number

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

    • Default value atime: Date = new Date()

      time of last access

    • Default value mtime: Date = new Date()

      time of last modification

    • Default value ctime: Date = new Date()

      time of creation

    Returns Stats

Properties

atime

atime: Date

time of last access

birthtime

birthtime: Date = new Date(0)

blksize

blksize: number = 4096

blocks

blocks: number

ctime

ctime: Date

time of creation

dev

dev: number = 0

UNSUPPORTED ATTRIBUTES I assume no one is going to need these details, although we could fake appropriate values if need be.

fileData

fileData: Buffer | null = null

gid

gid: number = 0

ino

ino: number = 0

mode

mode: number

mtime

mtime: Date

time of last modification

nlink

nlink: number = 1

rdev

rdev: number = 0

size

size: number

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

uid

uid: number = 0

Static atime

atime: Date

Static blksize

blksize: number

Static blocks

blocks: number

Static ctime

ctime: Date

Static dev

dev: number

Static gid

gid: number

Static ino

ino: number

Static mode

mode: number

Static mtime

mtime: Date

Static nlink

nlink: number

Static rdev

rdev: number

Static size

size: number

Static Optional timestamp

timestamp: undefined | number

Static uid

uid: number

Methods

chmod

  • chmod(mode: number): void
  • 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

clone

isBlockDevice

  • isBlockDevice(): boolean

isCharacterDevice

  • isCharacterDevice(): boolean

isDirectory

  • isDirectory(): boolean

isFIFO

  • isFIFO(): boolean

isFile

  • isFile(): boolean

isSocket

  • isSocket(): boolean

isSymbolicLink

  • isSymbolicLink(): boolean

toBuffer

  • toBuffer(): Buffer

Static fromBuffer

  • fromBuffer(buffer: Buffer): Stats

Generated using TypeDoc