MCPcopy
hub / github.com/kubernetes/test-infra / get

Function get

triage/interactive.js:282–299  ·  view source on GitHub ↗
(uri, callback, onprogress)

Source from the content-addressed store, hash-verified

280// Download a file from GCS and invoke callback with the result.
281// extracted/modified from kubernetes/test-infra/gubernator/static/build.js
282function get(uri, callback, onprogress) {
283 if (uri[0] === '/') {
284 // Matches /bucket/file/path -> [..., "bucket", "file/path"]
285 var groups = uri.match(/([^/:]+)\/(.*)/);
286 var bucket = groups[1], path = groups[2];
287 var url = 'https://www.googleapis.com/storage/v1/b/' + bucket + '/o/' +
288 encodeURIComponent(path) + '?alt=media';
289 } else {
290 var url = uri;
291 }
292 var req = new XMLHttpRequest();
293 req.open('GET', url);
294 req.onload = function(resp) {
295 callback(req);
296 };
297 req.onprogress = onprogress;
298 req.send();
299}
300
301// Cached job-to-repo mapping, loaded from job_repos.json.
302// null if not yet loaded or unavailable (graceful fallback).

Callers 1

getDataFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected