mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +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
@@ -6,7 +6,7 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { readFile as fsReadFile } from 'fs/promises';
|
||||
import { createReadStream } from 'fs';
|
||||
|
||||
export class ReadBinaryFile implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -58,7 +58,7 @@ export class ReadBinaryFile implements INodeType {
|
||||
|
||||
let data;
|
||||
try {
|
||||
data = await fsReadFile(filePath);
|
||||
data = createReadStream(filePath);
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
throw new NodeOperationError(
|
||||
|
||||
Reference in New Issue
Block a user