Releases: theophilusx/ssh2-sftp-client
New event handling strategy
This release introduces a new event handling strategy.
- Global event listeners no longer raise errors. Only log events and invalidate connection object.
- Constructor allows passing in custom global event listeners whi8chn can do whatever is appropriate for the client
- All temporary local event listeners wil now call the associated promise rejedct method. Previously reject was only called for error events, but this caused problems for some badly behaving sftp servers which ended connections without signalling any error condition. This would cause promises to be stuck in an unfulfilled state.
While the above changes do not change the existing API, the change in global listener behaviour may result in changes for client code behaviour, so this update is marked as a whole new version. However, most clients should not experience any change an in fact, things should be more stable with less liklihood of uncaught errors killing top level processes. It is expected that few clients will need to supply custom global event listeners as the defaults should work fror the vast majority of clients 'out of the box'. Chances are very high you will be able to update to this vwersion from 10.0.3 with no impact or nee3d for code change.
Documentation fix Mk2
Restore missing README.md file
Typo fix in packagte.json
Just a stupid fat finger error fix!
Minor documentation update
Minor update to documentation to add links to allow supporters to donate to the project to help with on-going maintenance and support.
Bug fix and security update
- Bump to depend on ssh2 1.15.0, which has the fix for CVE-2023-48795
- Add new promiseLimit setting to limit the number of concurrent promises used by downloadDir/uploadDir. Default is set to 10. Testing indicated for most situations, increasing much above 10 had little benefit and eventually, once number was large enough, actually degraded performance as node would spend more time context switching than data transferring.
- Some minor code clenup and added quite a few new tests
- Changed minimum supported node version. While testing with v16.20.2 still appears to work, it is HIGHLY recommended that at least node 18.18.2 is used. Bottom line, if you log an issue, you need to be on node >= v18.
Maintenance Release
- Re-factoring of some methods to enable them to better catch network errors within surrounding promise.
- Fix error in handling options in some methods which prevented setting file permissions
- Added additional tests and test coverage
Minor bug fix release
- Fixes an issue with module hanging and failing to return any error when a corrupted private key was supplied. Now returns an error that the module was unable to parse the private key.
Minor bug fix release
Fix two minor bugs
-
Sometimes, when initialisation of sftp sub-system failed, the module would attempt to call sftp.end(), which would fail with an undefined reference error
-
When calling the get() method and supplying a destination stream for the data, if the soruce file did not exist on the remote server, the destination stream was not closed and could result in a resource leak.
Minor bug fixes
A couple of fairly minor changes to address some edge case issues
- DOn't throw error or reject promise if end() method called when there is no active sftp connection. If end() is called and there is no active connection, just turn into a noop. Better to call end() when not needed than miss calling it because it might cause an error in some scenarios.
- Don't throw exception or reject a promise when an 'unexpected' end or close event is seen. Logic for determining when a close or end event was 'unexpected' was not reliable enough. Besides, trying to identify unexpected close/end signals didn't really add any value. Now if a close or end signal occurs which was not 'expected', we will just log it. We do invalidate the sftp connection whenever we see an end/close event regardless.
- Now use nullish coalescing instead of or'iing to set the various params for retry configuration. Previously, using or'ing meant you couldn't set a param to 0. Using ?? now allows this.
- Made some minor changes to when the flags used to track event handling are reset. Previously, they were reset after temporary listeners were removed. We now do the reset after new temporary listeners are added.
None of the above changes are API breaking (for v9). Should be able to upgrade from any previous 9.x version with no issue.
Minor bug fix
Minor bug fix version
The get() method was not always returning a buffer when no destination argument was supplied due to a race condition between concat-stream and readStream finish event. When triggered, get() would return the concat-stream object instead of the buffer object it contains.