Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SFTP server endpoint powered by taruti/sftpd (with reference to leffss/sftpd)
Listen on 5222 port by default.
这个跟 FTP 服务器一样,也是除了我试了好像没问题以外什么都不能保证,SFTP 比 FTP 还过分,接口天然就是随机访问的形式的,哪怕客户端就是要顺序读写,也必须以随机读写的形式请求。这两个协议跟用 HTTP 传文件的那些协议设计理念上差距挺大的,适配起来确实很拧巴,就凑合着用吧。
FTP 实现了一个自定义命令
SITE SIZE
,在使用STOR
命令上传文件之前可以先使用这个命令提交文件大小,之后上传的时候就不会在本地产生临时文件,而是直接将数据流转发到存储介质了,不过要利用这个特性可能还需要写一些 FTP 客户端插件。我最开始看到 SFTP 上传文件会提交一个 length 参数,以为是完整的文件大小才写的这个 feat,后来才发现它其实是文件分片的大小,所以这个和 SFTP 没有关系的 feat 只能挤在这个提交里了。TODO: