function Stat(remoteObj)


Every client object has a method called Stat which tries to retrieve information about a remote object (file or directory) and, in doing so, checks whether such object exists or not.


This method always returns an object with the following structure:


{
  Valid  bool
  Exists bool
  Stat   DirListItem
}


Here's an example of a fully populated object of the above type.


{
  Valid  : true,
  Exists : true,
  Stat   : {
    Name: "/docs/budget.xlsx",
    Type: "FILE",
    Size: 526546,
    TimeStamp: 1576095950
  }
}


Valid is true when the .Stat command has returned valid information. Does not necessarily mean that the object exists, only that the command was executed without issues.


Exists is true if remoteObj (a file or directory on the remote file server) exists.


If and only if Exists is true, then the object's Stat property will contain meaningful information about the analyzed file/directory.


Example:

{
 var scli = new SftpClient();
 scli.Host = 'your.sftpserver.com:22';
 scli.User = 'someusername';
 scli.KeyFile = './my_id.rsa';
 if (scli.Connect()) {
  // perform your file transfers...
  // ...
  var res = scli.Stat('');
  if ((res.Valid) && (res.Exists)) {
   Log('The file exists and its size is '+res.Stat.Size);
  }
  // ...
  scli.Close();
 }
 scli = null
}