Skip to content

Function: isFileUrl() ​

ts
function isFileUrl(url): boolean;

Defined in: parse.ts:385

Whether a string is a single-file CDN URL, without parsing it or throwing. Pair with parseFileUrl when the input is untrusted.

Parameters ​

ParameterType
urlstring

Returns ​

boolean

See ​

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

Example ​

ts
isFileUrl(`https://ucarecdn.com/${uuid}/`) // → true
isFileUrl(`https://ucarecdn.com/${uuid}~3/`) // → false, that is a group