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

Method delete

src/fileSystem/sftp.js:343–372  ·  view source on GitHub ↗

* Delete file or directory

()

Source from the content-addressed store, hash-verified

341 * Delete file or directory
342 */
343 delete() {
344 const filename = this.#path;
345 const fullFilename = Url.join(this.#base, filename);
346 return new Promise((resolve, reject) => {
347 sftp.isConnected((connectionID) => {
348 (async () => {
349 if (this.#notConnected(connectionID)) {
350 try {
351 await this.connect();
352 } catch (error) {
353 reject(error);
354 return;
355 }
356 }
357 await this.#setStat();
358 sftp.rm(
359 this.#safeName(filename),
360 this.#stat.isDirectory ? true : false,
361 this.#stat.isDirectory ? true : false,
362 (_res) => {
363 resolve(fullFilename);
364 },
365 (err) => {
366 reject(err);
367 },
368 );
369 })();
370 }, reject);
371 });
372 }
373
374 pwd() {
375 return new Promise((resolve, reject) => {

Callers

nothing calls this directly

Calls 7

#notConnectedMethod · 0.95
connectMethod · 0.95
#setStatMethod · 0.95
#safeNameMethod · 0.95
resolveFunction · 0.85
rmMethod · 0.80
isConnectedMethod · 0.65

Tested by

no test coverage detected