Reporting Built-ins¶
Reporting Built-ins enable attaching files to a report and determining the file extension base on its MIME type.
Attaching Files to Report¶
Syntax
1 | attachToReport(<name String>, <mimeType String>, <fileToAttach File>) |
Parameters
-
name - The name of the attachment
- If left empty, the original name of the file will be used
-
mimeType - The two-part identifier used to designate the type of file attached
-
fileToAttach - The file to be attached
Example
1 2 3 4 5 6 7 | func attachFile(fileName) myFile := file("../../myproject/reports/0151021140131.pcap") myImage := file("../../myproject/reports.png") attachToReport(fileName+"Trace", "application/mytrace.pcap", myFile) attachToReport(fileName+"Image", "image/png", myImage) end |
MIME types and Resulting File Extensions of the Attached File¶
Below is the list of MIME types that can be used with the Reporting Built-in, and their file extensions.
Mimetype | Extension |
---|---|
"image/gif" | .gif |
"image/png" | .png |
"image/jpeg" | .jpg |
"audio/mp4" | .mp4 |
"audio/mpeg" | .mp3 |
"audio/vnd.wav", | .wav |
"text/plain" | .txt |
"text/html" | .html |
"text/xml" | .xml |
"text/javascript" | .*js |
"application/javascript" | .js |
"application/vnd.tcpdump.pcap" | .pcap |
"application/octet-stream" | "" |