Use native fs promise where possible (#1684)

This commit is contained in:
lublak
2021-05-01 04:22:15 +02:00
committed by GitHub
parent b7a074abd7
commit c83c05456d
7 changed files with 21 additions and 38 deletions

View File

@@ -1,9 +1,6 @@
import {
readFile as fsReadFile,
} from 'fs';
import { promisify } from 'util';
const fsReadFileAsync = promisify(fsReadFile);
} from 'fs/promises';
import { IExecuteFunctions } from 'n8n-core';
import {
@@ -162,7 +159,7 @@ export class ExecuteWorkflow implements INodeType {
let workflowJson;
try {
workflowJson = await fsReadFileAsync(workflowPath, { encoding: 'utf8' }) as string;
workflowJson = await fsReadFile(workflowPath, { encoding: 'utf8' }) as string;
} catch (error) {
if (error.code === 'ENOENT') {
throw new NodeOperationError(this.getNode(), `The file "${workflowPath}" could not be found.`);