(key: string)
| 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); |
no test coverage detected