nodejs sftp.与编码一起呼叫
我正在使用node.js的ssh2-sftp-client软件包。 我正在尝试进行SFTP调用,以获取具有特定编码的文件。 当我不使用任何编码时,我可以获取文件:
var config = {
host: urls,
port: port,
user: user,
password: password,
};
let sftp = new Client;
sftp.connect(config).then(() => {
sftp.get(file)
.then((response) => {My Code});
}
编码不正确。 根据文档该文件将到达:
sftp.get(remoteFilePath, [useCompression], [encoding], [addtionalOptions]);
当我尝试添加编码时:
sftp.get(file,[false],["iso-8859-1"])
我会收到一个错误消息:
wtr.once('error', (err) => {
^
TypeError: wtr.once is not a function
我尝试在没有数组括号的情况下添加:
sftp.get(file,false,"iso-8859-1")
但这也不起作用。
打电话时,如何指定文件的编码?
谢谢
I am using the ssh2-sftp-client package for Node.js.
I am trying to make an sftp call to get a file with a specific encoding.
I am able to get the file when I do not use any encoding:
var config = {
host: urls,
port: port,
user: user,
password: password,
};
let sftp = new Client;
sftp.connect(config).then(() => {
sftp.get(file)
.then((response) => {My Code});
}
The encoding is incorrect.
According to the documentation, I can specify the encoding the file will arrive in:
sftp.get(remoteFilePath, [useCompression], [encoding], [addtionalOptions]);
When I try to add the encoding:
sftp.get(file,[false],["iso-8859-1"])
I get an error message:
wtr.once('error', (err) => {
^
TypeError: wtr.once is not a function
I tried to add without the array brackets:
sftp.get(file,false,"iso-8859-1")
But that doesn't work either.
How can I specify the encoding of the file when I make the call?
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论