client.scp('/path/to/local/file', {
host: 'server_ip_address',
username: 'username',
password: 'password',
path: '/path/to/remote/directory'
}, function(err) {
if (err) {
console.log('文件上传失败:' + err);
} else {
console.log('文件上传成功!');
}
});
其中,/path/to/local/file
是本地计算机上的文件路径,server_ip_address
是您的服务器 IP 地址,username
是您在阿里云服务器上的用户名,password
是您在阿里云服务器上的密码,/path/to/remote/directory
是您想要将文件上传到的目标目录路径。