Remove executeSingle from ReadBinaryFile node

This commit is contained in:
dali 2021-02-16 08:09:10 +01:00
parent 46d1a5fe58
commit 8d119852f6
2 changed files with 36 additions and 28 deletions

View file

@ -134,7 +134,7 @@ export class EmailSend implements INodeType {
for (let itemIndex = 0; itemIndex < length; itemIndex++) { for (let itemIndex = 0; itemIndex < length; itemIndex++) {
item = items[itemIndex]; item = items[itemIndex];
console.log(item,itemIndex)
const fromEmail = this.getNodeParameter('fromEmail', itemIndex) as string; const fromEmail = this.getNodeParameter('fromEmail', itemIndex) as string;
const toEmail = this.getNodeParameter('toEmail', itemIndex) as string; const toEmail = this.getNodeParameter('toEmail', itemIndex) as string;
const ccEmail = this.getNodeParameter('ccEmail', itemIndex) as string; const ccEmail = this.getNodeParameter('ccEmail', itemIndex) as string;

View file

@ -1,4 +1,4 @@
import { IExecuteSingleFunctions } from 'n8n-core'; import { IExecuteFunctions } from 'n8n-core';
import { import {
INodeExecutionData, INodeExecutionData,
INodeType, INodeType,
@ -49,11 +49,17 @@ export class ReadBinaryFile implements INodeType {
}; };
async executeSingle(this: IExecuteSingleFunctions): Promise<INodeExecutionData> { async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
const item = this.getInputData(); const items = this.getInputData();
const dataPropertyName = this.getNodeParameter('dataPropertyName') as string; const returnData: INodeExecutionData[] = [];
const filePath = this.getNodeParameter('filePath') as string; const length = items.length as unknown as number;
let item: INodeExecutionData;
for (let itemIndex = 0; itemIndex < length; itemIndex++) {
item = items[itemIndex];
const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex) as string;
const filePath = this.getNodeParameter('filePath', itemIndex) as string;
let data; let data;
try { try {
@ -79,8 +85,10 @@ export class ReadBinaryFile implements INodeType {
} }
newItem.binary![dataPropertyName] = await this.helpers.prepareBinaryData(data, filePath); newItem.binary![dataPropertyName] = await this.helpers.prepareBinaryData(data, filePath);
returnData.push(newItem);
}
return newItem; return this.prepareOutputData(returnData);
} }
} }