MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / exists

Method exists

packages/filesystem/dropbox/dropbox.ts:236–255  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

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 {

Callers 2

writeMethod · 0.80
dropbox.test.tsFile · 0.80

Calls 3

requestMethod · 0.95
isDropboxPathNotFoundFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected