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

Method present

src/core/operations/ImageOpacity.mjs:81–91  ·  view source on GitHub ↗

* Displays the image using HTML for web apps * @param {ArrayBuffer} data * @returns {html}

(data)

Source from the content-addressed store, hash-verified

79 * @returns {html}
80 */
81 present(data) {
82 if (!data.byteLength) return "";
83 const dataArray = new Uint8Array(data);
84
85 const type = isImage(dataArray);
86 if (!type) {
87 throw new OperationError("Invalid file type.");
88 }
89
90 return `<img src="data:${type};base64,${toBase64(dataArray)}">`;
91 }
92}
93
94export default ImageOpacity;

Callers

nothing calls this directly

Calls 2

isImageFunction · 0.90
toBase64Function · 0.90

Tested by

no test coverage detected