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

Method _readFileFromRoot

src/fsDropbox.ts:675–697  ·  view source on GitHub ↗
(key: string)

Source from the content-addressed store, hash-verified

673 }
674
675 async _readFileFromRoot(key: string): Promise<ArrayBuffer> {
676 const rsp = await retryReq(
677 () =>
678 this.dropbox.filesDownload({
679 path: key,
680 }),
681 `downloadFromRemoteRaw=${key}`
682 );
683 if (rsp === undefined) {
684 throw Error(`unknown rsp from dropbox download: ${rsp}`);
685 }
686 if ((rsp.result as any).fileBlob !== undefined) {
687 // we get a Blob
688 const content = (rsp.result as any).fileBlob as Blob;
689 return await content.arrayBuffer();
690 } else if ((rsp.result as any).fileBinary !== undefined) {
691 // we get a Buffer
692 const content = (rsp.result as any).fileBinary as Buffer;
693 return bufferToArrayBuffer(content);
694 } else {
695 throw Error(`unknown rsp from dropbox download: ${rsp}`);
696 }
697 }
698
699 async rename(key1: string, key2: string): Promise<void> {
700 const remoteFileName1 = getDropboxPath(key1, this.remoteBaseDir);

Callers 1

readFileMethod · 0.95

Calls 2

bufferToArrayBufferFunction · 0.90
retryReqFunction · 0.85

Tested by

no test coverage detected