VOOZH about

URL: https://www.geeksforgeeks.org/node-js/node-js-stats-mode-property-from-fs-stats-class/

⇱ Node.js stats.mode Property from fs.Stats Class - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node.js stats.mode Property from fs.Stats Class

Last Updated : 25 Jun, 2020
The stats.mode property is an inbuilt application programming interface of the fs.Stats class which is used to get the file type and mode as bit-field. Syntax:
stats.mode;
Return Value: It returns a number or BigInt value that represents a bit-field that describes the file type and mode. Below examples illustrate the use of stats.mode in Node.js: Example 1: Output:
using stat: the type and mode bit-field of the file is 33206
using lstat: the type and mode bit-field of the file is 33206
using stat: the type and mode bit-field of the file is 16822
using lstat: the type and mode bit-field of the file is 16822
Example 2: Output:
(node:9448) ExperimentalWarning: The fs.promises API
is experimental 
using stat synchronous: the type and mode bit-field 
of the file is 33206
Note: The above program will compile and run by using the node filename.js command and use the file_path correctly. Reference: https://nodejs.org/api/fs.html#fs_stats_mode
Comment

Explore