basic-ftp
Advanced tools
Comparing version 2.12.2 to 2.12.3
# Changelog | ||
## 2.12.3 | ||
- Minor changes to documentation. | ||
## 2.12.2 | ||
@@ -4,0 +8,0 @@ |
@@ -565,4 +565,4 @@ "use strict"; | ||
} | ||
const controlIP = client.ftp.socket.remoteAddress; | ||
await connectForPassiveTransfer(controlIP, port, client.ftp); | ||
const controlHost = client.ftp.socket.remoteAddress; | ||
await connectForPassiveTransfer(controlHost, port, client.ftp); | ||
return res; | ||
@@ -569,0 +569,0 @@ } |
{ | ||
"name": "basic-ftp", | ||
"version": "2.12.2", | ||
"version": "2.12.3", | ||
"description": "FTP client for Node.js with support for explicit FTPS over TLS.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/ftp", |
@@ -13,7 +13,7 @@ # Basic FTP | ||
The following example shows how to connect, upgrade to TLS, login, get a directory listing and upload a file. Note that the FTP protocol doesn't allow multiple requests running in parallel. | ||
The following example will connect to a server, upgrade to TLS, login, get a directory listing, and upload a file. Note that the FTP protocol doesn't allow multiple requests running in parallel. | ||
```js | ||
const ftp = require("basic-ftp") | ||
const fs = require("fs") | ||
const ftp = require("basic-ftp") | ||
@@ -27,3 +27,3 @@ example() | ||
host: "myftpserver.com", | ||
user: "very" | ||
user: "very", | ||
password: "password", | ||
@@ -42,3 +42,3 @@ secure: true | ||
The next example shows how to work with directories and their content. First, we make sure a remote path exists, creating all directories as necessary. We then remove any existing directories or files from it and upload the contents of a local one. | ||
The next example shows how to work with directories and their content. First, we make sure a remote path exists, creating all directories as necessary. Then, we remove any existing directories and files from it and upload the contents of a local one. | ||
@@ -69,6 +69,21 @@ ```js | ||
`connect(host = localhost, port = 21): Promise<Response>` | ||
`access(options): Promise<Response>` | ||
Connect to an FTP server. | ||
Convenience method to get access to an FTP server. This method calls *connect*, *useTLS*, *login* and *useDefaultSettings* described below. It returns the response of the initial connect command. The available options are: | ||
- `host (string)`: Host to connect to | ||
- `port (number)`: Port to connect to | ||
- `user (string)`: Username for login | ||
- `password (string)`: Password for login | ||
- `secure (boolean)`: Use explicit FTPS over TLS | ||
- `secureOptions`: Options for TLS, same as for [tls.connect()](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback) in Node.js. | ||
--- | ||
The following setup methods are for advanced users who want to customize an aspect of accessing an FTP server. If you use *client.access* you won't need them. | ||
`connect(host = "localhost", port = 21): Promise<Response>` | ||
Connect to an FTP server. | ||
`useTLS([options]): Promise<Response>` | ||
@@ -86,13 +101,2 @@ | ||
`access(options): Promise<Response>` | ||
Convenience method to get access to an FTP server. This method calls *connect*, *useTLS*, *login* and *useDefaultSettings*. It returns the response of the initial connect command. The available options are: | ||
- `host`: Host to connect to | ||
- `port`: Port to connect to | ||
- `user`: Username for login | ||
- `password`: Password for login | ||
- `secure`: Use explicit FTPS over TLS | ||
- `secureOptions`: Options for TLS, same as for [tls.connect()](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback) in Node.js. | ||
--- | ||
@@ -249,2 +253,10 @@ | ||
`get/set encoding` | ||
Get or set the encoding applied to all incoming and outgoing messages of the control connection. This encoding is also used when parsing a list response from a data connection. Node supports `utf8`, `latin1` and `ascii`. Default is `utf8` because it's backwards-compatible with `ascii` and many modern servers support it, some of them without mentioning it when requesting features. You can change this setting at any time. | ||
`get/set ipFamily` | ||
Set the preferred version of the IP stack: `4` (IPv4), `6` (IPv6) or `undefined` (Node.js default). Set to `undefined` by default. | ||
`get/set socket` | ||
@@ -258,6 +270,2 @@ | ||
`get/set encoding` | ||
Get or set the encoding applied to all incoming and outgoing messages of the control connection. This encoding is also used when parsing a list response from a data connection. Node supports `utf8`, `latin1` and `ascii`. Default is `utf8` because it's backwards-compatible with `ascii` and many modern servers support it, some of them without mentioning it when requesting features. You can change this setting at any time. | ||
`handle(command, handler): Promise<Response>` | ||
@@ -264,0 +272,0 @@ |
105503
301