File Tools
Version: 3.0.9
Manipulating files through the file integrations API.
Connect File Tools with LogicHub
- Navigate to Automations > Integrations.
- Search for File Tools.
- Click Details, then the + icon. Enter the required information in the following fields.
- Label: Enter a connection name.
- Reference Values: Define variables here to templatize integration connections and actions. For example, you can use https://www.{{hostname}}.com where, hostname is a variable defined in this input. For more information on how to add data, see 'Add Data' Input Type for Integrations.
- Verify SSL: Select option to verify connecting server's SSL certificate (Default is Verify SSL Certificate).
- Remote Agent: Run this integration using the LogicHub Remote Agent.
- After you've entered all the details, click Connect.
Actions for File Tools
Inspect File
Inspect the file and returns its MD5, SHA-1 & SHA-256 hashes, size, and MIME type.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
Filename Column Name | Name of the column containing the file to inspect. | Required |
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- result: A JSON with the md5 hash, the size in bytes, and the mime-type of the file.
Load .docx into a JSON Object
Load DOCX into JSON.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
Filename Column Name | A filename pointing to a .docx archive. | Required |
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- result: The content of the main xml document.
Load CSV into a JSON Object
Load CSV into JSON.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
Filename Column Name | Name of the column containing the filename/lhub_file_id to load. | Required |
Header Names | If a CSV file will not have headers, provide a comma-separated list of headers to use. | Optional |
Columns to Keep | If you only need specific columns, provide a comma-separated list of column names and the rest will be dropped from the results. | Optional |
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- result: The content of the csv file.
Save Table as PDF
Save data of parent table into a PDF file.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
Document Title | Title of PDF Document positioned at top center. Position can be customized using the Additional Options input below. | Optional |
Header Row | Provide an HTML table row item (maybe with custom HTML formatting) representing a header row. You can also provide a comma-separated list of headers to use (Default is parent table headers without any special HTML formatting). Example: <tr><th>Column 1</th><th>Column 2</th><th>Column 3</th></tr> | Optional |
Table Style Definitions | Table style definition. Example: CSS stylings such as borders and padding. | Optional |
@import url('https://fonts.googleapis.com/css?family=Lato:400,700');
table {
border-collapse: collapse;
font-family: 'Lato';
font-weight: 400;
}
table th, table td {
padding: 8px;
}
table th {
font-weight: 700;
}
Input Name | Description | Required |
---|---|---|
Per Row Template | Jinja templated HTML definition for each row. (Default is <tr><td>{{col1}}</td><td>{{col2}}</td><td>{{col3}}</td></tr> ). Nested table is supported using <lhub_json_table> custom tag as: <tr><td><lhub_json_table>{{json_column}}</lhub_json_table></td></tr> . You can also use hidden columns like lhub_id or lhub_page_num here (provide it templated as {{lhub_id}} ). | Required |
<td>{{label}}</td><td>{{panel2}}</td><td>{{event_count}}</td><td>{{report_order}}</td><td><lhub_json_table>{{events}}</lhub_json_table></td><td>{{lhub_id}}</td>
Input Name | Description | Required |
---|---|---|
Orientation | Select Orientation Landscape/Portrait of the final PDF document. (Default is Portrait) | Optional |
Additional Options | JSON containing options like margin-bottom, margin-left, page-size (page-height or page-width for more fine grained control on page-size) for PDF. You can specify all wkhtmltopdf options. You can drop '--' in option name. If option without value, use None, False or '' for dict value. | Optional |
- Orientation (Optional): Select Orientation Landscape/Portrait of the final PDF document. (Default is Portrait)
- Additional Options (Optional): JSON containing options like margin-bottom, margin-left, page-size (page-height or page-width for more fine grained control on page-size) for PDF.
You can specify all wkhtmltopdf options. You can drop '--' in option name. If option without value, use None, False or '' for dict value.
{
"page-size": "Letter",
"margin-top": "0.75in",
"margin-right": "0.75in",
"margin-bottom": "0.75in",
"margin-left": "0.75in",
"encoding": "UTF-8",
"no-outline": null
}
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- lhub_file_id: LogicHub File ID of PDF file.
{
"has_error": false,
"error": null,
"lhub_file_id": "828f3c0063554d0395e9ed6cd8920314.pdf"
}
Save Table into CSV
Save data of table into a CSV file.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
Include Hidden Fields | Include LogicHub hidden columns in the CSV output (default is True). | Required |
Row Limit | Maximum number of rows to process. Warning: Exceeding the default of 100000 for very large tables can impact overall performance. | Required |
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- result: File ID
Parse EML/MSG File as Email
Parse an EML or MSG file and extract its contents.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
Filename Column Name | Name of the column containing the filename to load. | Required |
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- result: Result in JSON format.
Read Text File
Read the contents of a text file.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
Filename Column Name | Name of the column containing the filename to load. | Required |
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- result: Content of file.
Download URL (Deprecated)
Download an URL and return the resulting file ID.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
URL Column Name | The name of the column with the URLs that you would like to download. | Required |
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- result: File ID
Download URL
Download an URL and return the resulting file id
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
URL | Jinja Templated text containing the URL that you would like to download | Required |
Custom Header | Jinja Templated text containing the custom header's value E.g : { "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1" } | Optional |
Output
JSON containing the following items:
{
"url":"https://lhub-qe-data.s3.us-east-2.amazonaws.com/integrationsData/virusData.csv",
"has_error":false,
"file_id":"6c94bf3a10be406ca00af680324cda96",
"error":null
}
Gunzip File
Gunzip a .gz file.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
Filename Column Name | Name of the column containing the filename to Gunzip. | Required |
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- result: File ID
Gzip File
Gzip a file.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
Filename Column Name | Name of the column containing the filename to Gzip. | Required |
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- result: File ID
Delete File
Delete the file by ID.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
File Id Column Name | Column name from parent table that contains the ID of the file to delete. | Required |
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- result: Success/Failure
Get Text From PDF
Get the first 50,000 characters of text in the PDF file.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
File ID Column Name | Column name from parent table that contains the ID of the file to read. | Required |
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- result: Text from PDF file.
Get Text From Docx
Get the first 50,000 characters of text in the docx file.
Input Field
Choose a connection that you have previously created and then fill in the necessary information in the following input fields to complete the connection.
Input Name | Description | Required |
---|---|---|
File Id Column Name | Column name from parent table that contains the ID of the file to read. | Required |
Output
A JSON object containing multiple rows of result:
- has_error: True/False
- error: message/null
- result: Text from docx file.
Release Notes
v3.0.9
- Updated Action Download URL to support usage of Custom headers while downloading.v3.0.0
- Updated architecture to support IO via filesystemv2.0.7
- Bug resolved in actionParse EML/MSG File as Email
for URL pattern recognition.v1.6.23
- Description changed in actionParse EML/MSG File as Email
for inputName of the column containing the file Id to load
.v1.6.22
- Bug resolved in actionParse EML/MSG File as Email
for encoding.v1.6.21
- Bug resolved for file's data decode for invalid start byte.v1.6.20
- Bug resolved for filename.v1.6.19
- Bug resolved for JosnDecode.
Updated 8 months ago