MCPcopy Create free account
hub / github.com/cloudinary/cloudinary_npm / isRemoteUrl

Function isRemoteUrl

lib/utils/isRemoteUrl.js:8–12  ·  view source on GitHub ↗

* Checks whether a given url or path is a local file * @param {string} url the url or path to the file * @returns {boolean} true if the given url is a remote location or data

(url)

Source from the content-addressed store, hash-verified

6 * @returns {boolean} true if the given url is a remote location or data
7 */
8function isRemoteUrl(url) {
9 const SUBSTRING_LENGTH = 120;
10 const urlSubstring = isString(url) && url.substring(0, SUBSTRING_LENGTH);
11 return isString(url) && /^ftp:|^https?:|^gs:|^s3:|^data:([\w-.]+\/[\w-.]+(\+[\w-.]+)?)?(;[\w-.]+=[\w-.]+)*;base64,([a-zA-Z0-9\/+\n=]+)$/.test(urlSubstring);
12}
13
14module.exports = isRemoteUrl;

Callers 1

uploader.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected