mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 04:47:29 -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);
|
||||
|
||||
returnData.dir = filePathParts.dir;
|
||||
returnData.fileName = filePathParts.base;
|
||||
|
||||
// Remove the dot
|
||||
|
|
|
@ -157,6 +157,10 @@
|
|||
<div class="label">File Name: </div>
|
||||
<div class="value">{{binaryData.fileName}}</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 class="label">File Extension:</div>
|
||||
<div class="value">{{binaryData.fileExtension}}</div>
|
||||
|
|
|
@ -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: {},
|
||||
};
|
||||
|
|
|
@ -9,6 +9,7 @@ export interface IBinaryData {
|
|||
data: string;
|
||||
mimeType: string;
|
||||
fileName?: string;
|
||||
dir?: string;
|
||||
fileExtension?: string;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue