basic-ftp
Advanced tools
Comparing version 3.6.0 to 3.7.0
# Changelog | ||
## 3.7.0 | ||
- Added: Users can access internal transfer modes to force a specific one. (#77) | ||
- Fixed: Handle stream error events for upload and download. | ||
## 3.6.0 | ||
@@ -4,0 +9,0 @@ |
@@ -233,1 +233,9 @@ /// <reference types="node" /> | ||
} | ||
/** | ||
* Prepare a data socket using passive mode over IPv6. | ||
*/ | ||
export declare function enterPassiveModeIPv6(client: Client): Promise<FTPResponse>; | ||
/** | ||
* Prepare a data socket using passive mode over IPv4. | ||
*/ | ||
export declare function enterPassiveModeIPv4(client: Client): Promise<FTPResponse>; |
@@ -297,5 +297,14 @@ "use strict"; | ||
async upload(source, remotePath) { | ||
const validPath = await this.protectWhitespace(remotePath); | ||
await this.prepareTransfer(this); | ||
return upload(this.ftp, this.progressTracker, source, validPath); | ||
const onError = (err) => this.ftp.closeWithError(err); | ||
source.once("error", onError); | ||
try { | ||
const validPath = await this.protectWhitespace(remotePath); | ||
await this.prepareTransfer(this); | ||
// Keep the keyword `await` or the `finally` clause below runs too early | ||
// and removes the event listener for the source stream too early. | ||
return await upload(this.ftp, this.progressTracker, source, validPath); | ||
} | ||
finally { | ||
source.removeListener("error", onError); | ||
} | ||
} | ||
@@ -312,6 +321,15 @@ /** | ||
async download(destination, remotePath, startAt = 0) { | ||
const validPath = await this.protectWhitespace(remotePath); | ||
await this.prepareTransfer(this); | ||
const command = startAt > 0 ? `REST ${startAt}` : `RETR ${validPath}`; | ||
return download(this.ftp, this.progressTracker, destination, command, validPath); | ||
const onError = (err) => this.ftp.closeWithError(err); | ||
destination.once("error", onError); | ||
try { | ||
const validPath = await this.protectWhitespace(remotePath); | ||
await this.prepareTransfer(this); | ||
const command = startAt > 0 ? `REST ${startAt}` : `RETR ${validPath}`; | ||
// Keep the keyword `await` or the `finally` clause below runs too early | ||
// and removes the event listener for the source stream too early. | ||
return await download(this.ftp, this.progressTracker, destination, command, validPath); | ||
} | ||
finally { | ||
destination.removeListener("error", onError); | ||
} | ||
} | ||
@@ -563,2 +581,3 @@ /** | ||
} | ||
exports.enterPassiveModeIPv6 = enterPassiveModeIPv6; | ||
/** | ||
@@ -599,2 +618,3 @@ * Parse an EPSV response. Returns only the port as in EPSV the host of the control connection is used. | ||
} | ||
exports.enterPassiveModeIPv4 = enterPassiveModeIPv4; | ||
/** | ||
@@ -601,0 +621,0 @@ * Parse a PASV response. |
{ | ||
"name": "basic-ftp", | ||
"version": "3.6.0", | ||
"version": "3.7.0", | ||
"description": "FTP client for Node.js, supports explicit FTPS over TLS, IPv6, Async/Await, and Typescript.", | ||
@@ -39,9 +39,9 @@ "main": "dist/index", | ||
"devDependencies": { | ||
"@types/node": "12.0.4", | ||
"@types/node": "12.0.10", | ||
"mocha": "6.1.4", | ||
"rimraf": "2.6.3", | ||
"tslint": "5.17.0", | ||
"typescript": "3.5.1", | ||
"tslint": "5.18.0", | ||
"typescript": "3.5.2", | ||
"js-yaml": ">=3.13.1" | ||
} | ||
} |
108806
2131