@lelantos-org/sdk / primitives / toAbsoluteUrl
Function: toAbsoluteUrl()
ts
function toAbsoluteUrl(u): string;Defined in: @lelantos-org/sdk/dist/core/url.d.ts:24
In a browser, resolve a page-relative reference to an absolute URL; anywhere else, and for anything already absolute, return it unchanged.
A relative artifact base ("/artifacts") fetches correctly but fails isHttpUrl, which loses artifact persistence. Resolving it also gives the byte cache one canonical key, so two spellings of one artifact cannot cause two downloads.
Outside a browser a bare string is a filesystem path, which new URL() would corrupt.
Parameters
| Parameter | Type |
|---|---|
u | string |
Returns
string