Open alextes opened 7 years ago
Are you able to make a test that fails with your use case?
Was hoping to get a way with not including one 😛. Here you go @sergi :
vsftpd
vsftpd
const fs = require('fs');
const JSFtp = require("jsftp");
const ftp = new JSFtp({ host: "51.15.68.200", user: "ftpuser", // defaults to "anonymous" pass: "NYTimes", // defaults to "@anonymous" debugMode: true, });
ftp.ls(".", function(err, res) { console.log('err is', err); });
const person = fs.readFileSync('person.json'); ftp.put(person, 'person.json', function(hadError) { if (!hadError) console.log("File transferred successfully!"); });
`person.json`
```json
{
"name": "alex",
"age": 24
}
It hangs after printing err is null
.
Let me know if I can do anything else.
You probably need to read person as a buffer I think readFileSync defaults to utf8
@devotox nope, the default for readFile encoding is null
in which case it returns a buffer 😉 .
When I read https://github.com/sergi/jsftp#ftpputsource-remotepath-callback I have impression that you could try
ftp.put('person.json', 'person.json', function(hadError) {
if (!hadError)
console.log("File transferred successfully!");
});
@simonh1000 true. This was a long time ago. I probably tried that too but can't be sure. In any case, the docs clearly state:
It accepts a string with the local path for the file, a Buffer, or a Readable stream as a source parameter.
Using Ubuntu Yakkety and vsftpd 3.0.3-7 uploading files does not work. Tried with Node 8, 6 and 4. Just executing auth works fine. Making a put fails with the following error: