sergi/jsftp

node 7.* does not read from socket stream

Opened this issue · 0 comments

erkie commented

In Node 7:

var Ftp = require("jsftp");

var ftp = new Ftp({...});
ftp.get("myfile", function(err, socket) {
    socket.on("data", function() {
        console.log("read chunk");
    });
});

This code does not work. The socket/stream does never read anything. I noticed that socket.pause() is called in jsftp.js. So you need to manually call socket.resume(); for it to fetch data again.

var Ftp = require("jsftp");

var ftp = new Ftp({...});
ftp.get("myfile", function(err, socket) {
    socket.on("data", function() {
        console.log("read chunk");
    });
    socket.resume();
});

Either this is a bug, or the documentation needs amending. Thoughts?