Open rahajason opened 5 years ago
Same here : (
Did you try another library?
Ran into this issue today as well – I ended up wrapping a Promise
around my c.get()
and it worked like a charm!
Code:
c.on("ready", async() => {
await new Promise((resolve) => {
c.get(filename, (err, stream) => {
...
resolve()
})
});
await new Promise((resolve) => {
c.get(filename2, (err, stream) => {
...
resolve()
})
})
...
c.end()
}
Why this error? after some downloaded files i got following error from terminal :
`let c = new FTPClient(); const remoteDirectory = '/xxx/xxxx/'; const localDirectory = '/var/www/api/xxx/xxx/'; let contrats = [];
Error: Unable to make data connection 0|server | at Socket.<anonymous> (/var/www/api/node_modules/ftp/lib/connection.js:935:10) 0|server | at Object.onceWrapper (events.js:254:19) 0|server | at Socket.emit (events.js:164:20) 0|server | at Object.cb (/var/www/api/node_modules/ftp/lib/connection.js:575:18) 0|server | at Parser.<anonymous> (/var/www/api/node_modules/ftp/lib/connection.js:117:20) 0|server | at Parser.emit (events.js:159:13) 0|server | at Parser._write (/var/www/api/node_modules/ftp/lib/parser.js:59:10) 0|server | at doWrite (_stream_writable.js:388:12) 0|server | at writeOrBuffer (_stream_writable.js:374:5) 0|server | at Parser.Writable.write (_stream_writable.js:291:11) 0|server | at Socket.ondata (/var/www/api/node_modules/ftp/lib/connection.js:273:20) 0|server | at Socket.emit (events.js:159:13) 0|server | at addChunk (_stream_readable.js:265:12) 0|server | at readableAddChunk (_stream_readable.js:252:11) 0|server | at Socket.Readable.push (_stream_readable.js:209:10) 0|server | at TCP.onread (net.js:598:20) PM2 | App [server] with id [0] and pid [6461], exited with code [1] via signal [SIGINT]