The
stats.dev property is an inbuilt application programming interface of the fs.Stats class is used to get the numeric (number / bigint) identity of the device in which the file is situated.
Syntax:
stats.dev;
Parameters: This property does not accept any parameter.
Return Value: It returns a number or BigInt value which represents the identity of the device in which the file is situated.
Below examples illustrate the use of stats.dev property in Node.js:
Example 1:
Output:
using stat: the numeric identity of the device is 891323748
using lstat: the numeric identity of the device is 891323748
using stat: the numeric identity of the device is 891323748
using lstat: the numeric identity of the device is 891323748
Example 2:
Output:
The numeric identity of the device is 891323748
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_dev