MCPcopy Create free account
hub / github.com/apache/tvm / put

Method put

web/src/artifact_cache.ts:183–200  ·  view source on GitHub ↗
(request: RequestLike, response: Response)

Source from the content-addressed store, hash-verified

181 }
182
183 async put(request: RequestLike, response: Response): Promise<void> {
184 const url = this.normalizeRequest(request);
185 const blob = await response.blob();
186 const hash = await this.getBlobHash(blob);
187 const api = this.getApi();
188 if (!api) {
189 throw new Error("Cross-origin storage API unavailable.");
190 }
191 const handle = await api.requestFileHandle(hash, { create: true });
192 if (!handle) {
193 throw new Error("Cross-origin storage API returned no handle.");
194 }
195 const writableStream = await handle.createWritable();
196 await writableStream.write(blob);
197 await writableStream.close();
198 this.hashCache.set(url, hash);
199 await this.persistHashEntry(url, hash);
200 }
201
202 async delete(_request: RequestLike): Promise<void> {
203 // Cross-origin storage extension currently has no delete API.

Callers 2

persistHashEntryMethod · 0.45
addToCacheMethod · 0.45

Calls 8

normalizeRequestMethod · 0.95
getBlobHashMethod · 0.95
getApiMethod · 0.95
persistHashEntryMethod · 0.95
requestFileHandleMethod · 0.80
createWritableMethod · 0.65
writeMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected