mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
🔀 Merge branch 'binary-file-path' of https://github.com/lublak/n8n into lublak-binary-file-path
This commit is contained in:
commit
d65e8ee73b
|
@ -103,6 +103,7 @@ export async function prepareBinaryData(binaryData: Buffer, filePath?: string, m
|
||||||
|
|
||||||
const filePathParts = path.parse(filePath as string);
|
const filePathParts = path.parse(filePath as string);
|
||||||
|
|
||||||
|
returnData.dir = filePathParts.dir;
|
||||||
returnData.fileName = filePathParts.base;
|
returnData.fileName = filePathParts.base;
|
||||||
|
|
||||||
// Remove the dot
|
// Remove the dot
|
||||||
|
|
|
@ -157,6 +157,10 @@
|
||||||
<div class="label">File Name: </div>
|
<div class="label">File Name: </div>
|
||||||
<div class="value">{{binaryData.fileName}}</div>
|
<div class="value">{{binaryData.fileName}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="binaryData.dir">
|
||||||
|
<div class="label">Directory: </div>
|
||||||
|
<div class="value">{{binaryData.dir}}</div>
|
||||||
|
</div>
|
||||||
<div v-if="binaryData.fileExtension">
|
<div v-if="binaryData.fileExtension">
|
||||||
<div class="label">File Extension:</div>
|
<div class="label">File Extension:</div>
|
||||||
<div class="value">{{binaryData.fileExtension}}</div>
|
<div class="value">{{binaryData.fileExtension}}</div>
|
||||||
|
|
|
@ -60,14 +60,12 @@ export class ReadBinaryFiles implements INodeType {
|
||||||
const items: INodeExecutionData[] = [];
|
const items: INodeExecutionData[] = [];
|
||||||
let item: INodeExecutionData;
|
let item: INodeExecutionData;
|
||||||
let data: Buffer;
|
let data: Buffer;
|
||||||
let fileName: string;
|
|
||||||
for (const filePath of files) {
|
for (const filePath of files) {
|
||||||
data = await fsReadFileAsync(filePath) as Buffer;
|
data = await fsReadFileAsync(filePath) as Buffer;
|
||||||
|
|
||||||
fileName = path.parse(filePath).base;
|
|
||||||
item = {
|
item = {
|
||||||
binary: {
|
binary: {
|
||||||
[dataPropertyName]: await this.helpers.prepareBinaryData(data, fileName),
|
[dataPropertyName]: await this.helpers.prepareBinaryData(data, filePath),
|
||||||
},
|
},
|
||||||
json: {},
|
json: {},
|
||||||
};
|
};
|
||||||
|
|
|
@ -9,6 +9,7 @@ export interface IBinaryData {
|
||||||
data: string;
|
data: string;
|
||||||
mimeType: string;
|
mimeType: string;
|
||||||
fileName?: string;
|
fileName?: string;
|
||||||
|
dir?: string;
|
||||||
fileExtension?: string;
|
fileExtension?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue