MCPcopy
hub / github.com/gchq/CyberChef / formatContent

Method formatContent

src/core/Utils.mjs:1064–1073  ·  view source on GitHub ↗
(buff, type)

Source from the content-addressed store, hash-verified

1062 };
1063
1064 const formatContent = function (buff, type) {
1065 if (type.startsWith("image")) {
1066 let dataURI = "data:";
1067 dataURI += type + ";";
1068 dataURI += "base64," + toBase64(buff);
1069 return "<img style='max-width: 100%;' src='" + dataURI + "'>";
1070 } else {
1071 return `<pre>${Utils.escapeHtml(Utils.arrayBufferToStr(buff.buffer))}</pre>`;
1072 }
1073 };
1074
1075 const formatFile = async function(file, i) {
1076 const buff = await Utils.readFile(file);

Callers

nothing calls this directly

Calls 3

toBase64Function · 0.90
escapeHtmlMethod · 0.80
arrayBufferToStrMethod · 0.80

Tested by

no test coverage detected