How will you get information about a file using Node?
Answer:
Following is the syntax of the method to get the information about a file:
fs.stat(path, callback)
Parameters
Here is the description of the parameters used:
-
path - This is string having file name including path.
-
callback - This is the callback function which gets two arguments (err, stats) where stats is an object of fs.Stats type which is printed below in the example.