(path: string)
| 234 | |
| 235 | // 检查文件或文件夹是否存在 |
| 236 | async exists(path: string): Promise<boolean> { |
| 237 | try { |
| 238 | const myHeaders = new Headers(); |
| 239 | myHeaders.append("Content-Type", "application/json"); |
| 240 | |
| 241 | await this.request("https://api.dropboxapi.com/2/files/get_metadata", { |
| 242 | method: "POST", |
| 243 | headers: myHeaders, |
| 244 | body: JSON.stringify({ |
| 245 | path: path, |
| 246 | }), |
| 247 | }); |
| 248 | return true; |
| 249 | } catch (e) { |
| 250 | if (isDropboxPathNotFound(e)) { |
| 251 | return false; |
| 252 | } |
| 253 | throw e; |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | // 清除相关缓存 |
| 258 | clearRelatedCache(path: string): void { |
no test coverage detected