mikeal / sequest

Simplified API for SSH and SFTP similar to request.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: SFTP session ended early

nickolasclarke opened this issue · comments

JS (and programming) noob here:

when using the .get method I can successfully get the payload I want back, at which point things crash and burn. From what I can gather, this may be a bug in the dependency of ssh2-streams (mscdex/ssh2-streams#28) but I may just be doing it wrong. See my code and the subsequent error below, your patience and help is much appreciated!:

var sequest = require('sequest');

var test;
   var reader = sequest.get('user@server.com', '/home/user/config.json', {
       readyTimeout: 20000
     }, function (error, stdout) {
       if (error) {
         throw error;
       }
     }
   );
   reader.pipe(test = process.stdout);
   console.log(test);
        throw er; // Unhandled 'error' event
              ^
Error: SFTP session ended early
    at SFTPStream._cleanup (/home/nclarke/node_modules/sequest/node_modules/ssh2/node_modules/ssh2-streams/lib/sftp.js:195:15)
    at SFTPStream.onFinish (/home/nclarke/node_modules/sequest/node_modules/ssh2/node_modules/ssh2-streams/lib/sftp.js:159:10)
    at SFTPStream.EventEmitter.emit (events.js:117:20)
    at finishMaybe (_stream_writable.js:356:12)
    at endWritable (_stream_writable.js:363:3)
    at SFTPStream.Writable.end (_stream_writable.js:341:5)
    at Channel.onend (_stream_readable.js:483:10)
    at Channel.g (events.js:180:16)
    at Channel.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:920:16````