mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
Remove executeSingle from ReadPdf node
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
BINARY_ENCODING,
|
BINARY_ENCODING,
|
||||||
IExecuteSingleFunctions,
|
IExecuteFunctions,
|
||||||
} from 'n8n-core';
|
} from 'n8n-core';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -37,22 +37,30 @@ export class ReadPdf implements INodeType {
|
|||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {
|
||||||
|
const items = this.getInputData();
|
||||||
|
|
||||||
async executeSingle(this: IExecuteSingleFunctions): Promise<INodeExecutionData> {
|
const returnData: INodeExecutionData[] = [];
|
||||||
|
const length = items.length as unknown as number;
|
||||||
|
let item: INodeExecutionData;
|
||||||
|
|
||||||
const binaryPropertyName = this.getNodeParameter('binaryPropertyName') as string;
|
for (let itemIndex = 0; itemIndex < length; itemIndex++) {
|
||||||
|
|
||||||
const item = this.getInputData();
|
item = items[itemIndex];
|
||||||
|
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', itemIndex) as string;
|
||||||
|
|
||||||
|
if (item.binary === undefined) {
|
||||||
|
item.binary = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
const binaryData = Buffer.from(item.binary[binaryPropertyName].data, BINARY_ENCODING);
|
||||||
|
returnData.push({
|
||||||
|
binary: item.binary,
|
||||||
|
json: await pdf(binaryData),
|
||||||
|
});
|
||||||
|
|
||||||
if (item.binary === undefined) {
|
|
||||||
item.binary = {};
|
|
||||||
}
|
}
|
||||||
|
return this.prepareOutputData(returnData);
|
||||||
const binaryData = Buffer.from(item.binary[binaryPropertyName].data, BINARY_ENCODING);
|
|
||||||
|
|
||||||
return {
|
|
||||||
binary: item.binary,
|
|
||||||
json: await pdf(binaryData),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user