n8n-nodes-base
Version:
Base nodes of n8n
135 lines (130 loc) • 5.43 kB
text/typescript
/**
* Extract from File Node - Version 1.1
* Convert binary data to JSON
*/
export interface ExtractFromFileV11Params {
operation?: 'csv' | 'html' | 'fromIcs' | 'fromJson' | 'ods' | 'pdf' | 'rtf' | 'text' | 'xml' | 'xls' | 'xlsx' | 'binaryToPropery';
/**
* Input Binary Field
* @hint The name of the input field containing the file data to be processed
* @displayOptions.show { operation: ["csv", "html", "rtf", "ods", "xls", "xlsx", "binaryToPropery", "fromJson", "text", "fromIcs", "xml", "pdf"] }
* @default data
*/
binaryPropertyName?: string | Expression<string> | PlaceholderValue;
/**
* Options
* @displayOptions.show { operation: ["csv", "html", "rtf", "ods", "xls", "xlsx", "binaryToPropery", "fromJson", "text", "fromIcs", "xml", "pdf"] }
* @default {}
*/
options?: {
/** Set the field delimiter, usually a comma
* @displayOptions.show { /operation: ["csv"] }
* @default ,
*/
delimiter?: string | Expression<string> | PlaceholderValue;
/** Encoding
* @displayOptions.show { /operation: ["csv"] }
* @default utf-8
*/
encoding?: 'ascii' | 'latin1' | 'ucs-2' | 'ucs2' | 'utf-8' | 'utf16le' | 'utf8' | Expression<string>;
/** Whether to detect and exclude the byte-order-mark from the CSV Input if present
* @displayOptions.show { /operation: ["csv"] }
* @default false
*/
enableBOM?: boolean | Expression<boolean>;
/** Whether to handle unclosed quotes in CSV fields as part of the field's content instead of throwing a parsing error
* @displayOptions.show { /operation: ["csv"] }
* @default false
*/
relaxQuotes?: boolean | Expression<boolean>;
/** Whether the first row of the file contains the header names
* @displayOptions.show { /operation: ["ods", "xls", "xlsx", "csv", "html"] }
* @default true
*/
headerRow?: boolean | Expression<boolean>;
/** Whether to include empty cells when reading from file. They will be filled with an empty string.
* @displayOptions.show { /operation: ["ods", "xls", "xlsx", "csv", "html"] }
* @default false
*/
includeEmptyCells?: boolean | Expression<boolean>;
/** Stop handling records after the requested number of rows are read. Use -1 if you want to load all rows.
* @displayOptions.show { /operation: ["csv"] }
* @default -1
*/
maxRowCount?: number | Expression<number>;
/** The range to read from the table. If set to a number it will be the starting row. If set to string it will be used as A1-style notation range.
* @displayOptions.show { /operation: ["ods", "xls", "xlsx"] }
*/
range?: string | Expression<string> | PlaceholderValue;
/** Whether to return RAW data, instead of parsing it
* @default false
*/
rawData?: boolean | Expression<boolean>;
/** In some cases and file formats, it is necessary to read as string to ensure special characters are interpreted correctly
* @default false
*/
readAsString?: boolean | Expression<boolean>;
/** Name of the sheet to read from in the spreadsheet
* @displayOptions.show { /operation: ["ods", "xls", "xlsx"] }
* @default Sheet
*/
sheetName?: string | Expression<string> | PlaceholderValue;
/** Start handling records from the requested line number. Starts at 0.
* @displayOptions.show { /operation: ["csv"] }
* @default 0
*/
fromLine?: number | Expression<number>;
/** Skip Records With Errors
* @displayOptions.show { /operation: ["csv"] }
* @default {"value":{"enabled":true,"maxSkippedRecords":-1}}
*/
skipRecordsWithErrors?: {
/** Value
*/
value?: {
/** Whether to skip records with errors when reading from file
* @default false
*/
enabled?: boolean | Expression<boolean>;
/** The maximum number of records that can be skipped, will throw an error if exceeded. Set to -1 to remove limit.
* @default -1
*/
maxSkippedRecords?: number | Expression<number>;
};
};
/** Whether to strip the BOM (Byte Order Mark) from the file, this could help in an environment where the presence of the BOM is causing issues or inconsistencies
* @displayOptions.show { encoding: ["utf8", "cesu8", "ucs2"] }
* @default true
*/
stripBOM?: boolean | Expression<boolean>;
/** Keep Source
* @default json
*/
keepSource?: 'json' | 'binary' | 'both' | Expression<string>;
/** Whether to join the text from all pages or return an array of text from each page
* @default true
*/
joinPages?: boolean | Expression<boolean>;
/** Maximum number of pages to include
* @default 0
*/
maxPages?: number | Expression<number>;
/** Prowide password, if the PDF is encrypted
*/
password?: string | Expression<string> | PlaceholderValue;
};
/**
* The name of the output field that will contain the extracted data
* @displayOptions.show { operation: ["binaryToPropery", "fromJson", "text", "fromIcs", "xml"] }
* @default data
*/
destinationKey?: string | Expression<string> | PlaceholderValue;
}
interface ExtractFromFileV11NodeBase {
type: 'n8n-nodes-base.extractFromFile';
version: 1.1;
}
export type ExtractFromFileV11ParamsNode = ExtractFromFileV11NodeBase & {
config: NodeConfig<ExtractFromFileV11Params>;
};
export type ExtractFromFileV11Node = ExtractFromFileV11ParamsNode;