Download (download files)

function Download(what, toWhere: string): boolean

The Download function download the file(s) specified in the what parameter (wildcards are allowed) to the toWhere destination directory on the local computer.


This function is not recursive, therefore when using wildcards, this function will not download matching files from sub-directories of the directory specified in the what parameter. For a recursive version of this function see the DownloadR function.


  var cli = new SftpClient();
  cli.Host = '';
  cli.User = 'someusername';
  cli.KeyFile = './my_id.rsa';
  if (cli.Connect()) {
    // ...
    if (cli.Download('/docs/*.xlsx', 'C:\\dest\\path')) {
      Log('file(s) downloaded');
    // ...
  cli = null