JavaScript 文件传输 SSH [英] JavaScript File Transfer SSH
问题描述
我目前正在开发一个基于浏览器的项目,我第一次使用 JavaScript、HTML 和 CSS,过去没有使用这些语言的经验.该项目基本上涉及以下内容:(1)允许用户通过以下代码上传 .csv 文件:
I'm currently working on a browser based project where I'm using JavaScript, HTML and CSS for the first time, having had no past experience with these languages. Basically the project involves the following: (1) allowing the user to upload a .csv file via the following code:
<input id="files" type="file" accept=".csv" />
(2) 读取文件,(3) 转换为 YAML 文件 (.yml) 和 (4) 通过 SSH/SCP/SFTP 将其上传到远程服务器.
(2) Reading the file, (3) converting to a YAML file (.yml) and (4) uploading it to a remote server via SSH/SCP/SFTP.
我已经完成了 (1) 和 (2) 但我真正遇到的问题是第 4 部分.我的问题是:
I've done (1) and (2) but what I'm having real trouble with is part 4. My questions are:
- 是否可以在 JavaScript 中通过 SSH/SCP/SFTP 将文件上传到远程服务器,请记住这是一个基于浏览器的项目.
- 如果不是,有哪些基于浏览器的替代方法允许用户执行此操作?
- 有没有关于使用 JavaScript 制作 .yml 文件的好资源?
谢谢.
推荐答案
客户端 JavaScript 中的安全性是一个有缺陷的想法,因此您不太可能找到基于 JS 的 SSH 实现(SSH 是非常复杂的协议族).最好的选择是使用 Java 小程序来完成这项工作(小程序必须经过正确的数字签名才能连接到第三方位置),或者将文件上传到 Web 服务器并让它将文件上传到其他地方.
Security in client-side JavaScript is a flawed idea and due to this it's unlikely that you will find JS-based SSH implementation (SSH is quite complex protocol family). The best options are either to have a Java applet to do the job (the applet must be properly digitally signed to be allowed to connect to third-party location) or upload the file to the web server and have it upload the file elsewhere.
这篇关于JavaScript 文件传输 SSH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!