MCPcopy
hub / github.com/remotely-save/remotely-save / rm

Method rm

pro/src/fsBox.ts:869–889  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

867 }
868
869 async rm(key: string): Promise<void> {
870 await this._init();
871
872 const cachedEntity = this.keyToBoxEntity[key];
873 const fileID = cachedEntity?.id;
874 if (cachedEntity === undefined || fileID === undefined) {
875 throw Error(`no fileID found for key=${key}`);
876 }
877
878 const access = await this._getAccessToken();
879 const auth = new BoxDeveloperTokenAuth({ token: access });
880 const client = new BoxClient({ auth });
881
882 if (cachedEntity.isFolder) {
883 await client.folders.deleteFolderById(fileID, {
884 queryParams: { recursive: true },
885 });
886 } else {
887 await client.files.deleteFileById(fileID);
888 }
889 }
890
891 async checkConnect(callbackFunc?: any): Promise<boolean> {
892 // if we can init, we can connect

Callers 2

clearDupFilesFunction · 0.45

Calls 2

_initMethod · 0.95
_getAccessTokenMethod · 0.95

Tested by

no test coverage detected