function safeDecodeURIComponent(text) { try { return decodeURIComponent(text); } catch (e) { return text; } } 
load file and add file content to cache

@param {String} filepath
@param {Object} options
@param {Object} files
@return {Object}
@api private
760948
function loadFile(filepath, options, files) {
  if (!files.get(filepath)) files.set(filepath, {});
  const obj = files.get(filepath);
  const filename = (obj.path = filepath);
  const stats = fs.statSync(filename);
  let buffer = fs.readFileSync(filename);

  obj.cacheControl = options.cacheControl;
  obj.maxAge = obj.maxAge ? obj.maxAge : options.maxAge || 0;
  obj.type = obj.mime = mime.lookup(filepath) || 'application/octet-stream';
  obj.mtime = stats.mtime;
  obj.length = stats.size;
  obj.md5 = crypto
    .createHash('md5')
    .update(buffer)
    .digest('base64');

  if (options.buffer) obj.buffer = buffer;

  buffer = null;
  return obj;
}
178258
function getFile(filepath) {
	var fileObj = {
			path: filepath,
			content: null
	};
    try {
        fs.accessSync(filepath, fs.F_OK);
    } catch(e) {
			console.log(e.message);
        return fileObj;
    }
		fileObj.content = fs.readFileSync(filepath, 'utf-8').trim();
		return fileObj;
}
1269417
function extractCodeBlocks(filepath) {
  return new Promise(function(fulfill, reject) {
    fs.readFile(filepath, 'utf8', function(err, text) {
      if (err) {
        console.log(err);
        reject(err);
      } else {
        var converter = new showdown.Converter();
        var html = converter.makeHtml(text);
        var $ = cheerio.load(html);
        var codeBlocks = $('pre code').map(function(index, elem) {
          var language = ($(elem).attr('class') || 'none language-none').split(' ')[0];
          return {
            filename: buildFilename(filepath, elem, $),
            content: $(elem).text(),
            language: language
          };
        });
        fulfill(codeBlocks.toArray());
      }
    });
  });
}
252741
function(src, filepath) {
					/*
					return '// Source: ' + filepath + '\n' +
						src.replace(/##VERSION##/g, '##FOUND##');
					*/
					src = src.replace(/##ID##/g, options.id);
					src = src.replace(/##VERSION##/g, options.version);
					src = src.replace(/##CODEBASE##/g, options.extension.updateUrl);
					return src;
				}
538245
function readFile(options, href) {
	var filePath = path.join(path.isAbsolute(href) ? options.root : path.dirname(options.from), href);

	return new Promise(function (resolve, reject) {
		return fs.readFile(filePath, 'utf8', function (err, res) {
			return err ? reject(err) : resolve(res);
		});
	});
}
1106305
function (filePath, encode) {
        encode = encode || 'utf-8';

        if (this.isFileSync(filePath)) {
            var raw = fs.readFileSync(filePath, encode);
            var exports = {};
            var context = {
                process: process,
                require: function(name) {
                    var module;
                    try {
                        module = require((function (_module) {
                            if (_module.charAt(0) !== '.') {
                                return _module;
                            }
                            return path.resolve(path.dirname(filePath), _module);
                        }(name)));
                    } catch (e) {
                        throw e;
                    }
                    return module;
                },
                __filename: __filename,
                __dirname: __dirname,
                console: console,
                module: {
                    exports: exports
                },
                exports: exports
            };

            try {
                return vm.runInNewContext(raw, context);
            } catch (e) {
                throw e;
            }
        }
        return {};
    }
276109
function fixedEncodeURIComponent (str) {
    return encodeURIComponent(str).replace(/[!'()*]/g, function(c) {
      return '%' + c.charCodeAt(0).toString(16);
    });
  }
1252837
function readFileOrError(uri) {
    var content;
    try {
        content = fs.readFileSync(uri, 'utf8');
    } catch (err) {
        return Result.Err(err);
    }

    return Result.Ok(content);
}
464732
function encodeUriParameterValue(value) {
    return encodeURIComponent(value).
    replace(/%40/gi, '@').
    replace(/%3A/gi, ':').
    replace(/%24/g, '$').
    replace(/%2C/gi, ',').
    replace(/%3B/gi, ';').
    replace(/%20/g, '+');
}
701194
function urlEncodeIfNecessary(s) {
		var regex = /[\\\"<>\.;]/;
		var hasBadChars = regex.exec(s) != null;
		return hasBadChars && typeof encodeURIComponent != UNDEF ? encodeURIComponent(s) : s;
	}
94982
def uriencode(uristring, safe='', encoding='utf-8', errors='strict'):
    """"""
    if not isinstance(uristring, bytes):
        uristring = uristring.encode(encoding, errors)
    if not isinstance(safe, bytes):
        safe = safe.encode('ascii')
    try:
        encoded = _encoded[safe]
    except KeyError:
        encoded = _encoded[b''][:]
        for i in _tointseq(safe):
            encoded[i] = _fromint(i)
        _encoded[safe] = encoded
    return b''.join(map(encoded.__getitem__, _tointseq(uristring)))
1314682
function decode (param) {
  try {
    return decodeURIComponent(param)
  } catch (_) {
    var err = new Error('Failed to decode param "' + param + '"')
    err.status = 400
    throw err
  }
}
89986
function( /*String*/ path, /*String?*/ encoding) {
					path = frontSlash(path);
					if (encoding === 'utf-8') {
						encoding = 'utf8';
					}
					if (!encoding) {
						encoding = 'utf8';
					}

					var text = cache[path].contents + "";
					//Hmm, would not expect to get A BOM, but it seems to happen,
					//remove it just in case.
					if (text.indexOf('\uFEFF') === 0) {
						text = text.substring(1, text.length);
					}


					return text;
				}
545547
private URI buildURI(String path) throws URISyntaxException
   {
      try
      {
         return new URI(path);
      }
      catch (URISyntaxException e)
      {
         return new URI(TextUtil.escape(path, '%', true));
      }
   }
367598
def _decode_content(self, content):
        
        content = smart_unicode(content)
        uri, _, content = content.partition(u'|')
        if content == self.NONE:
            content = None
        return uri or None, content
115078
protected String decodeContentParameter(String encodedContent, String encoding, CmsFile originalFile) {

        return decodeContent(encodedContent);
    }
656958
function(string) {
            var output = encodeURIComponent(string);
            output = output.replace(/[^A-Za-z0-9_.~\-%]+/g, escape);
            output = output.replace(/[*]/g, function(ch) {
                return "%" + ch.charCodeAt(0).toString(16).toUpperCase();
            });
            return output;
        }