2018-11-20 06:40:43 -05:00
/ * *
* @ author bwhitn [ brian . m . whitney @ outlook . com ]
* @ copyright Crown Copyright 2016
* @ license Apache - 2.0
* /
2018-11-20 22:36:29 -05:00
import Operation from "../Operation" ;
import OperationError from "../errors/OperationError" ;
2018-11-27 14:49:02 -05:00
import Mime from "../lib/Mime" ;
2018-11-20 22:36:29 -05:00
import Utils from "../Utils" ;
2018-11-20 06:40:43 -05:00
2018-11-20 22:36:29 -05:00
class ParseIMF extends Operation {
2018-11-20 06:40:43 -05:00
2018-11-20 22:36:29 -05:00
/ * *
2018-11-27 22:46:08 -05:00
* Internet Message Format constructor
2018-11-20 22:36:29 -05:00
* /
constructor ( ) {
super ( ) ;
this . name = "Parse Internet Message Format" ;
this . module = "Default" ;
2018-11-27 22:46:08 -05:00
this . description = [ "Parse an IMF formatted messages following RFC5322." ,
2018-11-20 22:36:29 -05:00
"<br><br>" ,
2018-11-27 22:46:08 -05:00
"Parses an IMF formated message. These often have the file extention ".eml"e; and contain the email headers and body. The output will be a file list of the root header and decoded mime parts." ,
2018-11-20 22:36:29 -05:00
] . join ( "\n" ) ;
this . infoURL = "https://tools.ietf.org/html/rfc5322" ;
this . inputType = "string" ;
2018-11-21 23:36:32 -05:00
this . outputType = "List<File>" ;
this . presentType = "html" ;
this . args = [
{
2018-11-27 22:46:08 -05:00
"name" : "Decode Encoded-Words" ,
2018-11-21 23:36:32 -05:00
"type" : "boolean" ,
"value" : false
}
] ;
2018-11-20 06:40:43 -05:00
}
2018-11-27 14:49:02 -05:00
run ( input , args ) {
let mimeObj = new Mime ( input ) ;
return mimeObj . decodeMime ( args [ 0 ] ) ;
}
2018-11-22 14:51:53 -05:00
/ * *
* Displays the files in HTML for web apps .
*
* @ param { File [ ] } files
* @ returns { html }
* /
async present ( files ) {
return await Utils . displayFilesAsHTML ( files ) ;
}
2018-11-20 06:40:43 -05:00
}
2018-11-27 22:46:08 -05:00
export default ParseIMF ;