title: Node js, PromiseFtp. How to download all files of directory and then delete them from ftp
body: <p>I am noob in Node.js. I try to download all files from directory using  <a href="https://www.npmjs.com/package/promise-ftp" rel="nofollow">PromiseFtp</a></p>
  
  <p>But I have a problem. I don't know how to begin downloading files. I make next:</p>
  
  <pre><code>var ftp = new PromiseFtp();
    ftp.connect({host: '------', user: '----------', password: '------------'})
    .then(function (serverMessage) {
      console.log('Server message: '+serverMessage);
      return ftp.list('/');
    }).then(function (list) {
      list.forEach(function (element, index, array) {
          if (element.name !== '..' &amp;&amp; element.name !== '.'){
              console.log(element.name)
          }
      })
  
    }).then(function () {
      return ftp.end();
    });
  </code></pre>
  
  <p>Now I have list of files. But I don't know what I must do. After downloading I must delete all files from ftp.  </p>
  
  <p>Please. Help me</p>