v9.0.0
版本发布时间: 2022-06-14 11:16:54
theophilusx/ssh2-sftp-client最新发布版本:v11.0.0(2024-08-07 10:09:55)
This is a major new version which includes both new methods and API changes as well as some code cleanup and refactoring to improve performance.
-
API Changes
- list() method now accepts a filter function instead of a regular expression to filter the list of items returned.
- Ability to set autoClose in options passed into get() and put() methods has been removed. Tis option caused confusion for developers and made the logic overly complicated for rare use cases. You can not just use the new createReadStream() and createWriteStream() when you want low level control.
- Ability to set 'end' property in pipe() operations used by get() and put() methods has been removed because it complicated the logic of get() and put() methods when only useful for a very small number of edge cases. Use getReadStream and getWriteStream and manage pipe() manually should you require this type of low level control
- The 3rd argument to uploadDir() and downloadDir() methods has been changed. Previously, this argument was a filter function. It is now an object which can have properties of 'filter', to supply a filter function and useFastGet/useFastPut, a boolean used to tell the method to use the potentially faster fastGet() or fastPut() method to transfer data.
-
New Methods
- createReadStream(): returns a read stream connected to a remote file on the sftp server
- createWriteStream(): returns a write stream connected to a remote file on the sftp server
- rcopy(): create a remote copy of a remote file on the sftp server
-
Other Changes
- downloadDi()/uploadDir() now uses asynchronous calls to transfer files to help improve speed
- The retry code used to retry making a connection after initial failure has been refactored and improved to more reliably handle retry options.
- Management of temporary event listeners has been refactored to make management of event listeners when using internal calls to various methods more efficient.
Although not benchmarked, the performance of this version appears to be significantly better than previous versions. Running the test suite completes much faster, despite quite a new new tests being added for the new methods.