mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
Make n8n work with older node versions (<10)
This commit is contained in:
@@ -5,7 +5,12 @@ import {
|
||||
INodeType,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { promises as fs } from 'fs';
|
||||
import {
|
||||
readFile as fsReadFile,
|
||||
} from 'fs';
|
||||
import { promisify } from "util";
|
||||
|
||||
const fsReadFileAsync = promisify(fsReadFile);
|
||||
|
||||
|
||||
export class ReadBinaryFile implements INodeType {
|
||||
@@ -55,7 +60,7 @@ export class ReadBinaryFile implements INodeType {
|
||||
|
||||
let data;
|
||||
try {
|
||||
data = await fs.readFile(filePath) as Buffer;
|
||||
data = await fsReadFileAsync(filePath) as Buffer;
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
throw new Error(`The file "${filePath}" could not be found.`);
|
||||
|
||||
Reference in New Issue
Block a user