Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new Promise(resolve => {
if (!blob || blob.size === 0) {
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 =
'
return new Promise(resolve => {
if (!blob || blob.size === 0) {
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 =
'