- Refactored event listeners to ensure end and close event listeners are added. Some sftp servers can abruptly close a connection without raising an error event. This could result in scripts hanging because the promise doe snot get resolved. Have now added end and close listeners to reject a promise if these events are raised which shold prevent or reduce such hangs.
- Refactored the retry code for connections. Now using the promise-retry package instead of just the plain retry package. This change means number of attempts tried is no longer reported in error messages when all attempts are exhausted. However, you can get this information in the debug trace if required.
- Added a new argument to the delete() method which will stop delete() from being rejected if the target object does not exist. Sometimes, you don't care if the target object for delete does not exist and don't want to see an error. Defaults to false.
- Added a n optional filter argument to the uploadDir and downloadDir methods. The filter is a regular expression which is used to match the files and sub-directories to be considered in the upload/download process. Can be used to exclude files/directories you don't want to upload/download.
- Removed a lot of argument validation code. This code was used to provide more meaningful error messages (sometimes, remote servers just report 'Failure', and provide no details about what the failure was. However, this additional argument checking was having a performance hit, especially when files being transferred were small. Decided to remove this validation code in favour of better performance. Turning on debug will often provide additional information which can be used to track down errors when necessary. Note that this does mean the error message text has changed. If you match errors based on the text of the error, you will need to review your code to ensure it still works.
Note that this version still uses ssh 0.8.9, which is known to have issues with node v14.x. The issue is caused by changes in node v14 which were rolled back in node version 15.3.x. The ssh2 maintainer is currently doing a re-write of the ssh2 module to address this and some other design issues. Once that re-write is complete and a new version of ssh2 is released, we will release a new version of ssh2-sftp-client. In the meantime, avoid using node v14.x.