jsftp icon indicating copy to clipboard operation
jsftp copied to clipboard

You're not logged in error after executing a command successfully

Open masterpreenz opened this issue 6 years ago • 0 comments

I find this really odd when I do

queue.push({}, function () {
    Ftp.get('data.json', function (err, socket) {
      if (err) {
        throw 'Error accessing data server, please try again';
        return;
      }

      socket.on('data', d => {
        data += d.toString();
      });

      socket.on('close', err => {
        if (err) {
          console.log('There was an error retrieving the file');
          return;
        }

        data = JSON.parse(data);
        emitData('data-loaded', data);
      });

      socket.resume();
    });
  });

This one works but if I do a follow up:

  queue.push({name: "client"}, function () {
    Ftp.ls("client", (err, res) => {
      if (err) {
        console.log(err);
        return;
      }

      console.log(res);
    });
  });

I get a You're not logged in error though I have managed to fix this problem by Logging in again

function loginFTP() {
  Ftp = new jsftp({
    host: 'xxxxx',
    port: 21,
    user: 'xxxxx',
    pass: 'xxxxx',
    useList: true
  });
}

function queueLogin() {
  queue.push({name: 'login'}, function () {
    loginFTP();
  });
}

Every after I do an action but I think it's wrong of there's something wrong

masterpreenz avatar Sep 10 '18 12:09 masterpreenz