From 8f318de288e04023003e86051e55a16c5628fb6a Mon Sep 17 00:00:00 2001 From: lublak Date: Mon, 15 Feb 2021 12:34:05 +0100 Subject: [PATCH 1/2] get also the dir data of the path --- packages/core/src/NodeExecuteFunctions.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/src/NodeExecuteFunctions.ts b/packages/core/src/NodeExecuteFunctions.ts index dcdc2bd4bb..ebf501a68b 100644 --- a/packages/core/src/NodeExecuteFunctions.ts +++ b/packages/core/src/NodeExecuteFunctions.ts @@ -103,6 +103,7 @@ export async function prepareBinaryData(binaryData: Buffer, filePath?: string, m const filePathParts = path.parse(filePath as string); + returnData.dir = filePathParts.dir; returnData.fileName = filePathParts.base; // Remove the dot From cb9f31c49d2906ba4525aae2f4f07316fc57efc2 Mon Sep 17 00:00:00 2001 From: lublak Date: Mon, 15 Feb 2021 13:25:30 +0100 Subject: [PATCH 2/2] add dir to different positions --- packages/editor-ui/src/components/RunData.vue | 4 ++++ packages/nodes-base/nodes/ReadBinaryFiles.node.ts | 4 +--- packages/workflow/src/Interfaces.ts | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/components/RunData.vue b/packages/editor-ui/src/components/RunData.vue index 8ce435b6d6..8df52c69b0 100644 --- a/packages/editor-ui/src/components/RunData.vue +++ b/packages/editor-ui/src/components/RunData.vue @@ -157,6 +157,10 @@
File Name:
{{binaryData.fileName}}
+
+
Directory:
+
{{binaryData.dir}}
+
File Extension:
{{binaryData.fileExtension}}
diff --git a/packages/nodes-base/nodes/ReadBinaryFiles.node.ts b/packages/nodes-base/nodes/ReadBinaryFiles.node.ts index 4e8d9f2ac3..7a42764f35 100644 --- a/packages/nodes-base/nodes/ReadBinaryFiles.node.ts +++ b/packages/nodes-base/nodes/ReadBinaryFiles.node.ts @@ -60,14 +60,12 @@ export class ReadBinaryFiles implements INodeType { const items: INodeExecutionData[] = []; let item: INodeExecutionData; let data: Buffer; - let fileName: string; for (const filePath of files) { data = await fsReadFileAsync(filePath) as Buffer; - fileName = path.parse(filePath).base; item = { binary: { - [dataPropertyName]: await this.helpers.prepareBinaryData(data, fileName), + [dataPropertyName]: await this.helpers.prepareBinaryData(data, filePath), }, json: {}, }; diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index fc1498651f..22b762fe82 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -9,6 +9,7 @@ export interface IBinaryData { data: string; mimeType: string; fileName?: string; + dir?: string; fileExtension?: string; }