mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Use native fs promise where possible (#1684)
This commit is contained in:
@@ -8,10 +8,7 @@ import {
|
||||
|
||||
import {
|
||||
readFile as fsReadFile,
|
||||
} from 'fs';
|
||||
import { promisify } from 'util';
|
||||
|
||||
const fsReadFileAsync = promisify(fsReadFile);
|
||||
} from 'fs/promises';
|
||||
|
||||
|
||||
export class ReadBinaryFile implements INodeType {
|
||||
@@ -64,7 +61,7 @@ export class ReadBinaryFile implements INodeType {
|
||||
|
||||
let data;
|
||||
try {
|
||||
data = await fsReadFileAsync(filePath) as Buffer;
|
||||
data = await fsReadFile(filePath) as Buffer;
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') {
|
||||
throw new NodeOperationError(this.getNode(), `The file "${filePath}" could not be found.`);
|
||||
|
||||
Reference in New Issue
Block a user