* Displays the covered image using HTML for web apps * @param {ArrayBuffer} data * @returns {html}
(data)
| 137 | * @returns {html} |
| 138 | */ |
| 139 | present(data) { |
| 140 | if (!data.byteLength) return ""; |
| 141 | const dataArray = new Uint8Array(data); |
| 142 | |
| 143 | const type = isImage(dataArray); |
| 144 | if (!type) { |
| 145 | throw new OperationError("Invalid file type."); |
| 146 | } |
| 147 | |
| 148 | return `<img src="data:${type};base64,${toBase64(dataArray)}">`; |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | export default CoverImage; |