Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

fs fstat

const fs = require("fs");
let fileFD = fs.openSync('/path/to/file.txt')
let fileStats = fs.fstatSync(fileFD);
fs.closeSync(fileFD);
console.log(fileStats);

/*
Data explanation:

Stats {
  dev: 3334475869,
  mode: 33206,
  nlink: 1,
  uid: 0,
  gid: 0,
  rdev: 0,
  blksize: 4096,
  ino: 2533274790451167,
  size: 1733,                           The total size in bytes.
  blocks: 8,
  atimeMs: 1649094822494.6228,          Access Time in Milliseconds
  mtimeMs: 1649093745577.4001,          Modify Time in Milliseconds
  ctimeMs: 1649093745577.4001,          Change Time in Milliseconds
  birthtimeMs: 1649002721717.3416,      Create Time in Milliseconds
  atime: 2022-04-04T17:53:42.495Z,      Access Time
  mtime: 2022-04-04T17:35:45.577Z,      Modify Time
  ctime: 2022-04-04T17:35:45.577Z,      Change Time
  birthtime: 2022-04-03T16:18:41.717Z   Create Time
}

Access Time = last access to the data of the file system entity
Modify Time = last modification time in milliseconds. 
				For example, the last change to file’s content.
Change Time = last time the file’s inode was changed in milliseconds. 
				Also changes when you change file’s ownership or access permissions.
Create Time = file was first created

https://www.brainbell.com/javascript/fs-stats-structure.html
*/
Source by nodejs.org #
 
PREVIOUS NEXT
Tagged: #fs #fstat
ADD COMMENT
Topic
Name
7+2 =