ssh2-sftp-client
Advanced tools
Comparing version 5.3.0 to 5.3.1
{ | ||
"name": "ssh2-sftp-client", | ||
"version": "5.3.0", | ||
"version": "5.3.1", | ||
"description": "ssh2 sftp client for node", | ||
@@ -34,3 +34,3 @@ "main": "src/index.js", | ||
"dotenv": "^8.2.0", | ||
"mocha": "^8.1.2", | ||
"mocha": "^8.1.3", | ||
"moment": "^2.27.0", | ||
@@ -37,0 +37,0 @@ "through2": "^4.0.2" |
@@ -449,3 +449,3 @@ /** | ||
*/ | ||
async get(remotePath, dst, options) { | ||
async get(remotePath, dst, options = {}) { | ||
const _get = (sftpPath, localDst, options) => { | ||
@@ -493,2 +493,5 @@ return new Promise((resolve, reject) => { | ||
); | ||
if (options.autoClose === false) { | ||
rdr.destroy(); | ||
} | ||
this.removeListener('error', errorListener); | ||
@@ -499,2 +502,5 @@ this.removeListener('close', closeListener); | ||
utils.removeListeners(rdr); | ||
if (options.autoClose === false) { | ||
rdr.destroy(); | ||
} | ||
if (typeof localDst === 'string') { | ||
@@ -683,6 +689,6 @@ resolve(localDst); | ||
*/ | ||
async put(localSrc, remotePath, options) { | ||
const _put = (src, dst, opts) => { | ||
async put(localSrc, remotePath, options = {}) { | ||
const _put = (src, dst, options) => { | ||
return new Promise((resolve, reject) => { | ||
this.debugMsg(`put -> ${dst} `, opts); | ||
this.debugMsg(`put -> ${dst} `, options); | ||
let closeListener = utils.makeCloseListener(this, reject, 'put'); | ||
@@ -692,3 +698,3 @@ this.client.prependListener('close', closeListener); | ||
this.client.prependListener('error', errorListener); | ||
let stream = this.sftp.createWriteStream(dst, opts); | ||
let stream = this.sftp.createWriteStream(dst, options); | ||
stream.once('error', (err) => { | ||
@@ -701,2 +707,5 @@ reject(utils.formatError(`${err.message} ${dst}`, 'put')); | ||
utils.removeListeners(stream); | ||
if (options.autoClose === false) { | ||
stream.destroy(); | ||
} | ||
resolve(`Uploaded data stream to ${dst}`); | ||
@@ -728,2 +737,5 @@ this.removeListener('error', errorListener); | ||
); | ||
if (options.autoClose === false) { | ||
stream.destroy(); | ||
} | ||
this.removeListener('error', errorListener); | ||
@@ -730,0 +742,0 @@ this.removeListener('close', closeListener); |
@@ -376,3 +376,3 @@ 'use strict'; | ||
try { | ||
let localPath = path.normalize(lPath); | ||
let localPath = path.resolve(lPath); | ||
let type = await localExists(localPath); | ||
@@ -379,0 +379,0 @@ switch (target) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
8
2001
229499
1424