我正在尝试使用sftp将数据流发送到远程文件,但是它显示类似 的错误,该错误在 上上传数据到EName的时间太长了< / p>
sftp.fastPut.err (/srv/node_modules/ssh2-sftp-client/src/index.js:272:15)
at onerror (/srv/node_modules/ssh2-streams/lib/sftp.js:1049:7)
at /srv/node_modules/ssh2-streams/lib/sftp.js:1054:14
at FSReqWrap.oncomplete (fs.js:135:15) 'catch error'
//代码
function sftp() {
let Client = require('ssh2-sftp-client');
let sftp = new Client();
var chunk = [];// it contains the data to send to remote file.
sftp.connect({
host: 'xxxxxxxx',
port: '22',
username: 'xxxxxxxxxx'
password: 'xxxxxxxx'
}).then(() => {
return sftp.put(chunk, 'remote file path','');
}).then((data) => {
console.log(data, 'the data info');
}).catch((err) => {
console.log(err, 'catch error');
});
}