From d8667a67be7bc7ae303ae9f3b96ee6dbb0326056 Mon Sep 17 00:00:00 2001 From: Brian Whitney Date: Thu, 22 Nov 2018 14:51:53 -0500 Subject: [PATCH] got file output working. Adding Mime walking --- src/core/operations/ParseIMF.mjs | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/src/core/operations/ParseIMF.mjs b/src/core/operations/ParseIMF.mjs index 81478c2e..eea43f0e 100644 --- a/src/core/operations/ParseIMF.mjs +++ b/src/core/operations/ParseIMF.mjs @@ -90,19 +90,41 @@ class ParseIMF extends Operation { let headerBody = ParseIMF.splitHeaderFromBody(input); let header = headerBody[0]; let headerArray = ParseIMF.parseHeader(header); - if (args[0]) { - header = ParseIMF.replaceDecodeWord(header); + if (args[0] && headerBody.length > 0) { + headerBody[0] = ParseIMF.replaceDecodeWord(headerBody[0]); } let retval = []; let i = 0; headerBody.forEach(function(file){ - file = new File(Array.from(file), "test"+String(i), {type: "text/plain"}) + file = new File([file], "test"+String(i), {type: "text/plain"}); retval.push(file); i++; }); return retval; } + /** + * Displays the files in HTML for web apps. + * + * @param {File[]} files + * @returns {html} + */ + async present(files) { + return await Utils.displayFilesAsHTML(files); + } + + /** + * Walks a MIME document and returns an array of Mime data and header objects. + * + * @param {string} input + * @param {object} header + * @returns {object[]} + */ + static walkMime(input, header) { + let output = []; + if header[""] + } + /** * Breaks the header from the body and returns [header, body] *