Options
All
  • Public
  • Public/Protected
  • All
Menu

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?: 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: 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

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

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 clone

Static fromBuffer

  • fromBuffer(buffer: Buffer): Stats

Generated using TypeDoc