Syntax:
Following is the syntax of the method to collect file information:

wt.stat(path, callback);

Parameters:

  • path − File name including path.
  • callback − Callback function with two arguments

Example:

var wt = require("wt");

wt.stat('test.txt', function (err, stats) {
   if (err) {
       return console.error(err);
   }
   console.log(stats);
   console.log("Collect file info successfully!");
   
   // Check file type
   console.log("isFile ? " + stats.isFile());
   console.log("isDirectory ? " + stats.isDirectory());    
});

 

Your Answer
Login
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.