| 93 | } |
| 94 | |
| 95 | private async createNewFile(content: string | Blob): Promise<void> { |
| 96 | const myHeaders = new Headers(); |
| 97 | myHeaders.append("Content-Type", "application/octet-stream"); |
| 98 | myHeaders.append( |
| 99 | "Dropbox-API-Arg", |
| 100 | JSON.stringify({ |
| 101 | path: this.path, |
| 102 | mode: "add", |
| 103 | autorename: false, |
| 104 | }) |
| 105 | ); |
| 106 | |
| 107 | await this.fs.request("https://content.dropboxapi.com/2/files/upload", { |
| 108 | method: "POST", |
| 109 | headers: myHeaders, |
| 110 | body: content instanceof Blob ? content : new Blob([content]), |
| 111 | }); |
| 112 | |
| 113 | return Promise.resolve(); |
| 114 | } |
| 115 | } |