MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / connect

Method connect

src/fileSystem/sftp.js:400–437  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

398 }
399
400 async connect() {
401 await new Promise((resolve, reject) => {
402 const retry = (err) => {
403 if (settings.value.retryRemoteFsAfterFail) {
404 if (++this.#retry > this.#MAX_TRY) {
405 this.#retry = 0;
406 reject(err);
407 } else {
408 this.connect().then(resolve).catch(reject);
409 }
410 } else {
411 reject(err);
412 }
413 };
414
415 if (this.#authenticationType === "key") {
416 sftp.connectUsingKeyFile(
417 this.#hostname,
418 this.#port,
419 this.#username,
420 this.#keyFile,
421 this.#passPhrase,
422 resolve,
423 retry,
424 );
425 return;
426 }
427
428 sftp.connectUsingPassword(
429 this.#hostname,
430 this.#port,
431 this.#username,
432 this.#password,
433 resolve,
434 retry,
435 );
436 });
437 }
438
439 async exists() {
440 return (await this.stat()).exists;

Callers 11

lsDirMethod · 0.95
createFileMethod · 0.95
createDirMethod · 0.95
writeFileMethod · 0.95
readFileMethod · 0.95
copyToMethod · 0.95
renameMethod · 0.95
deleteMethod · 0.95
pwdMethod · 0.95
retryMethod · 0.95
statMethod · 0.95

Calls 2

connectUsingPasswordMethod · 0.80
connectUsingKeyFileMethod · 0.65

Tested by

no test coverage detected