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

Function base64EncodeURL

lib/utils/encoding/base64EncodeURL.js:3–14  ·  view source on GitHub ↗
(sourceUrl)

Source from the content-addressed store, hash-verified

1const { base64Encode } = require('./base64Encode')
2
3function base64EncodeURL(sourceUrl) {
4 try {
5 sourceUrl = decodeURI(sourceUrl);
6 } catch (error) {
7 // ignore errors
8 }
9 sourceUrl = encodeURI(sourceUrl);
10 return base64Encode(sourceUrl)
11 .replace(/\+/g, '-') // Convert '+' to '-'
12 .replace(/\//g, '_') // Convert '/' to '_'
13 .replace(/=+$/, ''); // Remove ending '=';
14}
15
16
17module.exports.base64EncodeURL = base64EncodeURL;

Callers 2

process_custom_functionFunction · 0.85
process_layerFunction · 0.85

Calls 1

base64EncodeFunction · 0.85

Tested by

no test coverage detected