Make n8n work with older node versions (<10)

This commit is contained in:
Jan Oberhauser
2019-06-24 12:47:44 +02:00
parent b53d4c56ae
commit 034c70f6ab
5 changed files with 41 additions and 15 deletions

View File

@@ -4,10 +4,17 @@ import {
INodeType,
INodeTypeDescription,
} from 'n8n-workflow';
import { promises as fs } from 'fs';
import * as glob from 'glob-promise';
import * as path from 'path';
import {
readFile as fsReadFile,
} from 'fs';
import { promisify } from "util";
const fsReadFileAsync = promisify(fsReadFile);
export class ReadBinaryFiles implements INodeType {
description: INodeTypeDescription = {
displayName: 'Read Binary Files',
@@ -56,7 +63,7 @@ export class ReadBinaryFiles implements INodeType {
let data: Buffer;
let fileName: string;
for (const filePath of files) {
data = await fs.readFile(filePath) as Buffer;
data = await fsReadFileAsync(filePath) as Buffer;
fileName = path.parse(filePath).base;
item = {