refactor(core): Replace promisify-d node calls with native promises (no-changelog) (#8464)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-01-30 09:49:23 +01:00
committed by GitHub
parent 238b54c77b
commit 5cb55270b7
8 changed files with 19 additions and 46 deletions

View File

@@ -1,6 +1,5 @@
import { parse as pathParse } from 'path';
import { writeFile as fsWriteFile } from 'fs';
import { promisify } from 'util';
import { writeFile as fsWriteFile } from 'fs/promises';
import type {
IDataObject,
IExecuteFunctions,
@@ -14,7 +13,6 @@ import type {
import { deepCopy } from 'n8n-workflow';
import gm from 'gm';
import { file } from 'tmp-promise';
const fsWriteFileAsync = promisify(fsWriteFile);
import getSystemFonts from 'get-system-fonts';
const nodeOperations: INodePropertyOptions[] = [
@@ -1117,9 +1115,9 @@ export class EditImage implements INodeType {
binaryPropertyName,
);
const { fd, path, cleanup } = await file();
const { path, cleanup } = await file();
cleanupFunctions.push(cleanup);
await fsWriteFileAsync(fd, binaryDataBuffer);
await fsWriteFile(path, binaryDataBuffer);
if (operations[0].operation === 'create') {
// It seems like if the image gets created newly we have to create a new gm instance