MCPcopy Index your code
hub / github.com/codedogQBY/ReadAny / putFile

Method putFile

packages/core/src/sync/webdav-backend.ts:104–120  ·  view source on GitHub ↗
(
    path: string,
    localFilePath: string,
    onProgress?: (loaded: number, total: number) => void,
  )

Source from the content-addressed store, hash-verified

102 }
103
104 async putFile(
105 path: string,
106 localFilePath: string,
107 onProgress?: (loaded: number, total: number) => void,
108 ): Promise<void> {
109 const resolved = this.resolvePath(path);
110 try {
111 await this.client.putFile(resolved, localFilePath, onProgress);
112 } catch (e) {
113 const message = e instanceof Error ? e.message : String(e);
114 if (!/\b(403|404|409)\b/.test(message)) throw e;
115 const parent = resolved.substring(0, resolved.lastIndexOf("/"));
116 if (!parent || parent === "/") throw e;
117 await this.client.ensureDirectory(parent);
118 await this.client.putFile(resolved, localFilePath, onProgress);
119 }
120 }
121
122 async get(path: string): Promise<Uint8Array> {
123 return this.client.get(this.resolvePath(path));

Callers

nothing calls this directly

Calls 3

resolvePathMethod · 0.95
ensureDirectoryMethod · 0.80
putFileMethod · 0.65

Tested by

no test coverage detected