mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Remove executeSingle from WriteBinaryFile node
This commit is contained in:
parent
b0664d2aa0
commit
735a7e6812
|
@ -1,6 +1,7 @@
|
|||
import {
|
||||
BINARY_ENCODING,
|
||||
IExecuteSingleFunctions,
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions
|
||||
} from 'n8n-core';
|
||||
import {
|
||||
IDataObject,
|
||||
|
@ -53,11 +54,21 @@ export class WriteBinaryFile implements INodeType {
|
|||
};
|
||||
|
||||
|
||||
async executeSingle(this: IExecuteSingleFunctions): Promise<INodeExecutionData> {
|
||||
const item = this.getInputData();
|
||||
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||
|
||||
const dataPropertyName = this.getNodeParameter('dataPropertyName') as string;
|
||||
const fileName = this.getNodeParameter('fileName') as string;
|
||||
const items = this.getInputData();
|
||||
|
||||
const returnData: INodeExecutionData[] = [];
|
||||
const length = items.length as unknown as number;
|
||||
let item: INodeExecutionData;
|
||||
|
||||
for (let itemIndex = 0; itemIndex < length; itemIndex++) {
|
||||
|
||||
const dataPropertyName = this.getNodeParameter('dataPropertyName', itemIndex) as string;
|
||||
|
||||
const fileName = this.getNodeParameter('fileName', itemIndex) as string;
|
||||
|
||||
item = items[itemIndex];
|
||||
|
||||
if (item.binary === undefined) {
|
||||
throw new Error('No binary data set. So file can not be written!');
|
||||
|
@ -84,8 +95,12 @@ export class WriteBinaryFile implements INodeType {
|
|||
}
|
||||
|
||||
// Add the file name to data
|
||||
|
||||
(newItem.json as IDataObject).fileName = fileName;
|
||||
|
||||
return newItem;
|
||||
returnData.push(newItem);
|
||||
}
|
||||
return this.prepareOutputData(returnData);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue