jsftp
jsftp copied to clipboard
Can Ftp.get be copied to a buffer rather than to file ?
Hello Sergi,
Can we copy the file contents from remote (Ftp.get) into a buffer rather than a file ??
I tried this piece of code. This doesn't work.
var str = ""; // Will store the contents of the file ftp.get('remote/path/file.txt', function(err, socket) { if (err) return; socket.on("data", function(d) { str += d.toString(); }) socket.on("close", function(hadErr) { if (hadErr) console.error('There was an error retrieving the file.'); }); socket.resume(); });
Please help!
Running into the same problem 🙃