Skip to content

Function: parseFileUrl() ​

ts
function parseFileUrl(url): ParsedFileUrl;

Defined in: parse.ts:223

Parses a single-file URL, including conversion results. Narrower than parseCdnUrl: importing this alone keeps the group and proxy parsers out of your bundle, and the result is already narrowed to ParsedFileUrl without a kind check.

Parameters ​

ParameterType
urlstring

Returns ​

ParsedFileUrl

Throws ​

TypeError when the URL is not a single-file CDN URL.

See ​

https://uploadcare.com/docs/delivery/cdn/

Example ​

ts
parseFileUrl(`https://ucarecdn.com/${uuid}/-/resize/300x/photo.jpg`).uuid
// → uuid — no narrowing needed