mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
refactor(core): Replace promisify-d node calls with native promises (no-changelog) (#8464)
This commit is contained in:
committed by
GitHub
parent
238b54c77b
commit
5cb55270b7
@@ -1,8 +1,10 @@
|
||||
import { createWriteStream } from 'fs';
|
||||
import { basename, dirname } from 'path';
|
||||
import type { Readable } from 'stream';
|
||||
import { pipeline } from 'stream';
|
||||
import { promisify } from 'util';
|
||||
import { pipeline } from 'stream/promises';
|
||||
import { file as tmpFile } from 'tmp-promise';
|
||||
import ftpClient from 'promise-ftp';
|
||||
import sftpClient from 'ssh2-sftp-client';
|
||||
import { BINARY_ENCODING, NodeApiError } from 'n8n-workflow';
|
||||
import type {
|
||||
ICredentialDataDecryptedObject,
|
||||
@@ -16,10 +18,6 @@ import type {
|
||||
INodeTypeDescription,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { file as tmpFile } from 'tmp-promise';
|
||||
|
||||
import ftpClient from 'promise-ftp';
|
||||
import sftpClient from 'ssh2-sftp-client';
|
||||
import { formatPrivateKey } from '@utils/utilities';
|
||||
|
||||
interface ReturnFtpItem {
|
||||
@@ -40,8 +38,6 @@ interface ReturnFtpItem {
|
||||
path: string;
|
||||
}
|
||||
|
||||
const streamPipeline = promisify(pipeline);
|
||||
|
||||
async function callRecursiveList(
|
||||
path: string,
|
||||
client: sftpClient | ftpClient,
|
||||
@@ -722,7 +718,7 @@ export class Ftp implements INodeType {
|
||||
const binaryFile = await tmpFile({ prefix: 'n8n-sftp-' });
|
||||
try {
|
||||
const stream = await ftp!.get(path);
|
||||
await streamPipeline(stream, createWriteStream(binaryFile.path));
|
||||
await pipeline(stream, createWriteStream(binaryFile.path));
|
||||
|
||||
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i);
|
||||
const remoteFilePath = this.getNodeParameter('path', i) as string;
|
||||
|
||||
Reference in New Issue
Block a user