()
| 54 | } |
| 55 | |
| 56 | connect() { |
| 57 | return new Promise((resolve, reject) => { |
| 58 | ftp.connect( |
| 59 | this.#host, |
| 60 | +this.#port, |
| 61 | this.#username, |
| 62 | this.#password, |
| 63 | { |
| 64 | securityType: this.#security, |
| 65 | connectionMode: this.#mode, |
| 66 | encoding: settings.value.defaultFileEncoding, |
| 67 | }, |
| 68 | (conId) => { |
| 69 | this.#conId = conId; |
| 70 | resolve(); |
| 71 | }, |
| 72 | (err) => { |
| 73 | if (settings.value.retryRemoteFsAfterFail) { |
| 74 | if (++this.#try > this.#MAX_TRY) { |
| 75 | this.#try = 0; |
| 76 | reject(err); |
| 77 | return; |
| 78 | } |
| 79 | this.connect().then(resolve).catch(reject); |
| 80 | } else { |
| 81 | reject(err); |
| 82 | } |
| 83 | }, |
| 84 | ); |
| 85 | }); |
| 86 | } |
| 87 | |
| 88 | setPath(val) { |
| 89 | this.#path = val; |
no test coverage detected