Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
resolve("<i>none</i>");
return;
}
const file = blob as File;
if (blob.type === "application/json") {
solutionCommon.blobToJson(blob).then(
text => resolve(textAreaHtml(JSON.stringify(text, null, 2))),
error => resolve("<i>problem extracting JSON: " + error + "</i>")
);
} else if (
blob.type.startsWith("text/plain") ||
blob.type === "text/xml" ||
blob.type === "application/xml"
) {
solutionCommon.blobToText(blob).then(
text => resolve(textAreaHtml(text)),
error => resolve("<i>problem extracting text: " + error + "</i>")
);
} else if (blob.type.startsWith("image/")) {
let html =
'<img style="max-width:256px;border:1px solid lightgray;" src="' +
window.URL.createObjectURL(blob) +
'">';
if (file.name) {
html +=
' <a download="' +
file.name +
'" href="' +
window.URL.createObjectURL(file) +
'">' +
file.name +</a>
resolve("<i>none</i>");
return;
}
const file = blob as File;
if (blob.type === "application/json") {
common.blobToJson(blob).then(
text => resolve(textAreaHtml(JSON.stringify(text, null, 2))),
error => resolve("<i>problem extracting JSON: " + error + "</i>")
);
} else if (
blob.type.startsWith("text/plain") ||
blob.type === "text/xml" ||
blob.type === "application/xml"
) {
common.blobToText(blob).then(
text => resolve(textAreaHtml(text)),
error => resolve("<i>problem extracting text: " + error + "</i>")
);
} else if (blob.type.startsWith("image/")) {
let html =
'<img style="max-width:256px;border:1px solid lightgray;" src="' +
window.URL.createObjectURL(blob) +
'">';
if (file.name) {
html +=
' <a download="' +
file.name +
'" href="' +
window.URL.createObjectURL(file) +
'">' +
file.name +</a>