ssh2-sftp-client 7.2.0 → 7.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -61,7 +61,7 @@ an SFTP client for node.js, a wrapper around [SSH2](https://github.com/mscdex/ss
61
61
 
62
62
  Documentation on the methods and available options in the underlying modules can be found on the [SSH2](https://github.com/mscdex/ssh2) project pages.
63
63
 
64
- Current stable release is **v7.2.0**.
64
+ Current stable release is **v7.2.1**.
65
65
 
66
66
  Code has been tested against Node versions 14.18.2, 16.13.1 and 17.2.0
67
67
 
package/README.org CHANGED
@@ -9,7 +9,7 @@ convenience abstraction as well as a Promise based API.
9
9
  Documentation on the methods and available options in the underlying modules can
10
10
  be found on the [[https://github.com/mscdex/ssh2][SSH2]] project pages.
11
11
 
12
- Current stable release is *v7.2.0*.
12
+ Current stable release is *v7.2.1*.
13
13
 
14
14
  Code has been tested against Node versions 14.18.2, 16.13.1 and 17.2.0
15
15
 
package/package.json CHANGED
@@ -1,13 +1,17 @@
1
1
  {
2
2
  "name": "ssh2-sftp-client",
3
- "version": "7.2.0",
3
+ "version": "7.2.1",
4
4
  "description": "ssh2 sftp client for node",
5
5
  "main": "src/index.js",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "https://github.com/theophilusx/ssh2-sftp-client"
9
9
  },
10
- "keywords": ["sftp", "nodejs", "promises"],
10
+ "keywords": [
11
+ "sftp",
12
+ "nodejs",
13
+ "promises"
14
+ ],
11
15
  "scripts": {
12
16
  "test": "mocha",
13
17
  "coverage": "nyc npm run test",
@@ -36,11 +40,11 @@
36
40
  "chai-subset": "^1.6.0",
37
41
  "checksum": "^1.0.0",
38
42
  "dotenv": "^10.0.0",
39
- "eslint": "^8.3.0",
43
+ "eslint": "^8.5.0",
40
44
  "eslint-config-prettier": "^8.3.0",
41
- "eslint-plugin-mocha": "^9.0.0",
45
+ "eslint-plugin-mocha": "^10.0.3",
42
46
  "eslint-plugin-node": "^11.1.0",
43
- "eslint-plugin-promise": "^5.2.0",
47
+ "eslint-plugin-promise": "^6.0.0",
44
48
  "eslint-plugin-unicorn": "^39.0.0",
45
49
  "mocha": "^9.1.2",
46
50
  "moment": "^2.29.1",
package/src/index.js CHANGED
@@ -515,13 +515,29 @@ class SftpClient {
515
515
  )
516
516
  );
517
517
  });
518
- rdr.once('end', () => {
519
- if (typeof dst === 'string') {
520
- resolve(dst);
521
- } else {
522
- resolve(wtr);
523
- }
524
- });
518
+ if (
519
+ Object.hasOwnProperty.call(options, 'pipeOptions') &&
520
+ Object.hasOwnProperty.call(options.pipeOptions, 'end') &&
521
+ !options.pipeOptions.end
522
+ ) {
523
+ rdr.once('end', () => {
524
+ this.debugMsg('get resolved on reader end event');
525
+ if (typeof dst === 'string') {
526
+ resolve(dst);
527
+ } else {
528
+ resolve(wtr);
529
+ }
530
+ });
531
+ } else {
532
+ wtr.once('finish', () => {
533
+ this.debugMsg('get resolved on writer finish event');
534
+ if (typeof dst === 'string') {
535
+ resolve(dst);
536
+ } else {
537
+ resolve(wtr);
538
+ }
539
+ });
540
+ }
525
541
  }
526
542
  rdr.pipe(wtr, options.pipeOptions ? options.pipeOptions : {});
527
543
  }
@@ -530,14 +546,16 @@ class SftpClient {
530
546
  this._resetEventFlags();
531
547
  if (
532
548
  rdr &&
533
- options.readStreamOptions &&
549
+ Object.hasOwnProperty.call(options, 'readStreamOptions') &&
550
+ Object.hasOwnProperty.call(options.readStreamOptions, 'autoClose') &&
534
551
  options.readStreamOptions.autoClose === false
535
552
  ) {
536
553
  rdr.destroy();
537
554
  }
538
555
  if (
539
556
  wtr &&
540
- options.writeStreamOptions &&
557
+ Object.hasOwnProperty.call(options, 'writeStreamOptions') &&
558
+ Object.hasOwnProperty.call(options.writeStreamOptions, 'autoClose') &&
541
559
  options.writeStreamOptions.autoClose === false &&
542
560
  typeof dst === 'string'
543
561
  ) {
@@ -747,7 +765,8 @@ class SftpClient {
747
765
  this._resetEventFlags();
748
766
  if (
749
767
  rdr &&
750
- options.readStreamOptions &&
768
+ Object.hasOwnProperty.call(options, 'readStreamOptions') &&
769
+ Object.hasOwnProperty.call(options.readStreamOptions, 'autoClose') &&
751
770
  options.readStreamOptions.autoClose === false &&
752
771
  typeof localSrc === 'string'
753
772
  ) {