mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(Read Binary File Node): Use node streams for to reduce memory usage (#5069)
This commit is contained in:
committed by
GitHub
parent
a455cce7e6
commit
8bee04cd2a
@@ -1,8 +1,8 @@
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
import { INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||
import glob from 'fast-glob';
|
||||
|
||||
import { readFile as fsReadFile } from 'fs/promises';
|
||||
import { createReadStream } from 'fs';
|
||||
import type { Readable } from 'stream';
|
||||
|
||||
export class ReadBinaryFiles implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -47,9 +47,9 @@ export class ReadBinaryFiles implements INodeType {
|
||||
|
||||
const items: INodeExecutionData[] = [];
|
||||
let item: INodeExecutionData;
|
||||
let data: Buffer;
|
||||
let data: Readable;
|
||||
for (const filePath of files) {
|
||||
data = await fsReadFile(filePath);
|
||||
data = createReadStream(filePath);
|
||||
|
||||
item = {
|
||||
binary: {
|
||||
|
||||
Reference in New Issue
Block a user