MCPcopy Index your code
hub / github.com/nodejs/node / resolveObjectURL

Function resolveObjectURL

lib/internal/blob.js:366–400  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

364});
365
366function resolveObjectURL(url) {
367 url = `${url}`;
368 try {
369 const parsed = new URL(url);
370
371 const split = StringPrototypeSplit(parsed.pathname, ':', 3);
372
373 if (split.length !== 2)
374 return;
375
376 const {
377 0: base,
378 1: id,
379 } = split;
380
381 if (base !== 'nodedata')
382 return;
383
384 const ret = getDataObject(id);
385
386 if (ret === undefined)
387 return;
388
389 const {
390 0: handle,
391 1: length,
392 2: type,
393 } = ret;
394
395 if (handle !== undefined)
396 return createBlob(handle, length, type);
397 } catch {
398 // If there's an error, it's ignored and nothing is returned
399 }
400}
401
402// TODO(@jasnell): Now that the File class exists, we might consider having
403// this return a `File` instead of a `Blob`.

Callers 4

mainFunction · 0.85
schemeFetchFunction · 0.85
schemeFetchFunction · 0.85

Calls 1

createBlobFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…