From 75541e91f24bc244e7b2d856ddc35a9d4603f075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Mon, 25 Sep 2023 16:59:45 +0200 Subject: [PATCH] refactor(core)!: Make `getBinaryStream` async (#7247) Story: [PAY-846](https://linear.app/n8n/issue/PAY-846) | Related: https://github.com/n8n-io/n8n/pull/7225 For the S3 backend for external storage of binary data and execution data, the `getAsStream` method in the binary data manager interface used by FS and S3 will need to become async. This is a breaking change for nodes-base. --- packages/cli/BREAKING-CHANGES.md | 17 ++++++++++++ packages/cli/src/WebhookHelpers.ts | 11 ++++---- .../core/src/BinaryData/BinaryData.service.ts | 2 +- .../core/src/BinaryData/FileSystem.manager.ts | 2 +- packages/core/src/BinaryData/types.ts | 2 +- packages/core/src/NodeExecuteFunctions.ts | 2 +- .../nodes/Aws/S3/V2/AwsS3V2.node.ts | 5 +++- .../nodes-base/nodes/Crypto/Crypto.node.ts | 2 +- packages/nodes-base/nodes/Ftp/Ftp.node.ts | 4 +-- .../Google/CloudStorage/ObjectDescription.ts | 2 +- .../Google/Drive/v1/GoogleDriveV1.node.ts | 2 +- .../nodes/Google/Drive/v2/helpers/utils.ts | 2 +- .../nodes/Google/YouTube/YouTube.node.ts | 2 +- .../nodes/HttpRequest/GenericFunctions.ts | 26 +++++++++++++------ .../HttpRequest/V3/HttpRequestV3.node.ts | 13 +++++----- .../HttpRequest/test/utils/utils.test.ts | 12 ++++----- packages/nodes-base/nodes/Jira/Jira.node.ts | 2 +- .../nodes-base/nodes/Slack/V2/SlackV2.node.ts | 2 +- .../v2/SpreadsheetFileV2.node.ts | 2 +- packages/nodes-base/nodes/Ssh/Ssh.node.ts | 2 +- .../nodes/Telegram/Telegram.node.ts | 2 +- .../WriteBinaryFile/WriteBinaryFile.node.ts | 2 +- packages/workflow/src/Interfaces.ts | 2 +- 23 files changed, 74 insertions(+), 46 deletions(-) diff --git a/packages/cli/BREAKING-CHANGES.md b/packages/cli/BREAKING-CHANGES.md index 1dc69fb13a..e150b78207 100644 --- a/packages/cli/BREAKING-CHANGES.md +++ b/packages/cli/BREAKING-CHANGES.md @@ -2,6 +2,23 @@ This list shows all the versions which include breaking changes and how to upgrade. +## 1.9.0 + +### What changed? + +In nodes, `this.helpers.getBinaryStream()` is now async. + +### When is action necessary? + +If your node uses `this.helpers.getBinaryStream()`, add `await` when calling it. + +Example: + +```typescript +const binaryStream = this.helpers.getBinaryStream(id); // until 1.9.0 +const binaryStream = await this.helpers.getBinaryStream(id); // since 1.9.0 +``` + ## 1.5.0 ### What changed? diff --git a/packages/cli/src/WebhookHelpers.ts b/packages/cli/src/WebhookHelpers.ts index 703e4b63b8..bd3f1d156b 100644 --- a/packages/cli/src/WebhookHelpers.ts +++ b/packages/cli/src/WebhookHelpers.ts @@ -506,7 +506,7 @@ export async function executeWebhook( responsePromise = await createDeferredPromise(); responsePromise .promise() - .then((response: IN8nHttpFullResponse) => { + .then(async (response: IN8nHttpFullResponse) => { if (didSendResponse) { return; } @@ -514,10 +514,9 @@ export async function executeWebhook( const binaryData = (response.body as IDataObject)?.binaryData as IBinaryData; if (binaryData?.id) { res.header(response.headers); - const stream = Container.get(BinaryDataService).getAsStream(binaryData.id); - void pipeline(stream, res).then(() => - responseCallback(null, { noWebhookResponse: true }), - ); + const stream = await Container.get(BinaryDataService).getAsStream(binaryData.id); + await pipeline(stream, res); + responseCallback(null, { noWebhookResponse: true }); } else if (Buffer.isBuffer(response.body)) { res.header(response.headers); res.end(response.body); @@ -734,7 +733,7 @@ export async function executeWebhook( // Send the webhook response manually res.setHeader('Content-Type', binaryData.mimeType); if (binaryData.id) { - const stream = Container.get(BinaryDataService).getAsStream(binaryData.id); + const stream = await Container.get(BinaryDataService).getAsStream(binaryData.id); await pipeline(stream, res); } else { res.end(Buffer.from(binaryData.data, BINARY_ENCODING)); diff --git a/packages/core/src/BinaryData/BinaryData.service.ts b/packages/core/src/BinaryData/BinaryData.service.ts index d849bc6b19..4f6b63b367 100644 --- a/packages/core/src/BinaryData/BinaryData.service.ts +++ b/packages/core/src/BinaryData/BinaryData.service.ts @@ -89,7 +89,7 @@ export class BinaryDataService { }); } - getAsStream(binaryDataId: string, chunkSize?: number) { + async getAsStream(binaryDataId: string, chunkSize?: number) { const [mode, fileId] = binaryDataId.split(':'); return this.getManager(mode).getAsStream(fileId, chunkSize); diff --git a/packages/core/src/BinaryData/FileSystem.manager.ts b/packages/core/src/BinaryData/FileSystem.manager.ts index 33c2d7d39d..d103a1b0c6 100644 --- a/packages/core/src/BinaryData/FileSystem.manager.ts +++ b/packages/core/src/BinaryData/FileSystem.manager.ts @@ -36,7 +36,7 @@ export class FileSystemManager implements BinaryData.Manager { } } - getAsStream(fileId: string, chunkSize?: number) { + async getAsStream(fileId: string, chunkSize?: number) { const filePath = this.getPath(fileId); return createReadStream(filePath, { highWaterMark: chunkSize }); diff --git a/packages/core/src/BinaryData/types.ts b/packages/core/src/BinaryData/types.ts index f0edbdfb71..8bc628d777 100644 --- a/packages/core/src/BinaryData/types.ts +++ b/packages/core/src/BinaryData/types.ts @@ -29,7 +29,7 @@ export namespace BinaryData { getPath(fileId: string): string; getAsBuffer(fileId: string): Promise; - getAsStream(fileId: string, chunkSize?: number): Readable; + getAsStream(fileId: string, chunkSize?: number): Promise; getMetadata(fileId: string): Promise; // @TODO: Refactor to also use `workflowId` to support full path-like identifier: diff --git a/packages/core/src/NodeExecuteFunctions.ts b/packages/core/src/NodeExecuteFunctions.ts index 36bd2660b3..3815f45f8f 100644 --- a/packages/core/src/NodeExecuteFunctions.ts +++ b/packages/core/src/NodeExecuteFunctions.ts @@ -954,7 +954,7 @@ export async function getBinaryMetadata(binaryDataId: string): Promise { return Container.get(BinaryDataService).getAsStream(binaryDataId, chunkSize); } diff --git a/packages/nodes-base/nodes/Aws/S3/V2/AwsS3V2.node.ts b/packages/nodes-base/nodes/Aws/S3/V2/AwsS3V2.node.ts index a068579ac7..bff63bf3c3 100644 --- a/packages/nodes-base/nodes/Aws/S3/V2/AwsS3V2.node.ts +++ b/packages/nodes-base/nodes/Aws/S3/V2/AwsS3V2.node.ts @@ -870,7 +870,10 @@ export class AwsS3V2 implements INodeType { let uploadData: Buffer | Readable; multipartHeaders['Content-Type'] = binaryPropertyData.mimeType; if (binaryPropertyData.id) { - uploadData = this.helpers.getBinaryStream(binaryPropertyData.id, UPLOAD_CHUNK_SIZE); + uploadData = await this.helpers.getBinaryStream( + binaryPropertyData.id, + UPLOAD_CHUNK_SIZE, + ); const createMultiPartUpload = await awsApiRequestREST.call( this, servicePath, diff --git a/packages/nodes-base/nodes/Crypto/Crypto.node.ts b/packages/nodes-base/nodes/Crypto/Crypto.node.ts index 746cf083f0..35412582de 100644 --- a/packages/nodes-base/nodes/Crypto/Crypto.node.ts +++ b/packages/nodes-base/nodes/Crypto/Crypto.node.ts @@ -486,7 +486,7 @@ export class Crypto implements INodeType { const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i); const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName); if (binaryData.id) { - const binaryStream = this.helpers.getBinaryStream(binaryData.id); + const binaryStream = await this.helpers.getBinaryStream(binaryData.id); hashOrHmac.setEncoding(encoding); await pipeline(binaryStream, hashOrHmac); newValue = hashOrHmac.read(); diff --git a/packages/nodes-base/nodes/Ftp/Ftp.node.ts b/packages/nodes-base/nodes/Ftp/Ftp.node.ts index e807dd833c..1404208f4e 100644 --- a/packages/nodes-base/nodes/Ftp/Ftp.node.ts +++ b/packages/nodes-base/nodes/Ftp/Ftp.node.ts @@ -649,7 +649,7 @@ export class Ftp implements INodeType { let uploadData: Buffer | Readable; if (binaryData.id) { - uploadData = this.helpers.getBinaryStream(binaryData.id); + uploadData = await this.helpers.getBinaryStream(binaryData.id); } else { uploadData = Buffer.from(binaryData.data, BINARY_ENCODING); } @@ -759,7 +759,7 @@ export class Ftp implements INodeType { let uploadData: Buffer | Readable; if (binaryData.id) { - uploadData = this.helpers.getBinaryStream(binaryData.id); + uploadData = await this.helpers.getBinaryStream(binaryData.id); } else { uploadData = Buffer.from(binaryData.data, BINARY_ENCODING); } diff --git a/packages/nodes-base/nodes/Google/CloudStorage/ObjectDescription.ts b/packages/nodes-base/nodes/Google/CloudStorage/ObjectDescription.ts index 1a875b3baf..9bcb313db0 100644 --- a/packages/nodes-base/nodes/Google/CloudStorage/ObjectDescription.ts +++ b/packages/nodes-base/nodes/Google/CloudStorage/ObjectDescription.ts @@ -160,7 +160,7 @@ export const objectOperations: INodeProperties[] = [ const binaryData = this.helpers.assertBinaryData(binaryPropertyName); if (binaryData.id) { - content = this.helpers.getBinaryStream(binaryData.id); + content = await this.helpers.getBinaryStream(binaryData.id); const binaryMetadata = await this.helpers.getBinaryMetadata(binaryData.id); contentType = binaryMetadata.mimeType ?? 'application/octet-stream'; contentLength = binaryMetadata.fileSize; diff --git a/packages/nodes-base/nodes/Google/Drive/v1/GoogleDriveV1.node.ts b/packages/nodes-base/nodes/Google/Drive/v1/GoogleDriveV1.node.ts index 12ebdba9f3..3f10690e98 100644 --- a/packages/nodes-base/nodes/Google/Drive/v1/GoogleDriveV1.node.ts +++ b/packages/nodes-base/nodes/Google/Drive/v1/GoogleDriveV1.node.ts @@ -2442,7 +2442,7 @@ export class GoogleDriveV1 implements INodeType { const binaryData = this.helpers.assertBinaryData(i, binaryPropertyName); if (binaryData.id) { // Stream data in 256KB chunks, and upload the via the resumable upload api - fileContent = this.helpers.getBinaryStream(binaryData.id, UPLOAD_CHUNK_SIZE); + fileContent = await this.helpers.getBinaryStream(binaryData.id, UPLOAD_CHUNK_SIZE); const metadata = await this.helpers.getBinaryMetadata(binaryData.id); contentLength = metadata.fileSize; originalFilename = metadata.fileName; diff --git a/packages/nodes-base/nodes/Google/Drive/v2/helpers/utils.ts b/packages/nodes-base/nodes/Google/Drive/v2/helpers/utils.ts index 76df7b01f9..097ccefadb 100644 --- a/packages/nodes-base/nodes/Google/Drive/v2/helpers/utils.ts +++ b/packages/nodes-base/nodes/Google/Drive/v2/helpers/utils.ts @@ -40,7 +40,7 @@ export async function getItemBinaryData( if (binaryData.id) { // Stream data in 256KB chunks, and upload the via the resumable upload api - fileContent = this.helpers.getBinaryStream(binaryData.id, chunkSize); + fileContent = await this.helpers.getBinaryStream(binaryData.id, chunkSize); const metadata = await this.helpers.getBinaryMetadata(binaryData.id); contentLength = metadata.fileSize; originalFilename = metadata.fileName; diff --git a/packages/nodes-base/nodes/Google/YouTube/YouTube.node.ts b/packages/nodes-base/nodes/Google/YouTube/YouTube.node.ts index 6880aba1f1..f4038c4d53 100644 --- a/packages/nodes-base/nodes/Google/YouTube/YouTube.node.ts +++ b/packages/nodes-base/nodes/Google/YouTube/YouTube.node.ts @@ -838,7 +838,7 @@ export class YouTube implements INodeType { if (binaryData.id) { // Stream data in 256KB chunks, and upload the via the resumable upload api - fileContent = this.helpers.getBinaryStream(binaryData.id, UPLOAD_CHUNK_SIZE); + fileContent = await this.helpers.getBinaryStream(binaryData.id, UPLOAD_CHUNK_SIZE); const metadata = await this.helpers.getBinaryMetadata(binaryData.id); contentLength = metadata.fileSize; mimeType = metadata.mimeType ?? binaryData.mimeType; diff --git a/packages/nodes-base/nodes/HttpRequest/GenericFunctions.ts b/packages/nodes-base/nodes/HttpRequest/GenericFunctions.ts index fffb76b646..ccf6a14a12 100644 --- a/packages/nodes-base/nodes/HttpRequest/GenericFunctions.ts +++ b/packages/nodes-base/nodes/HttpRequest/GenericFunctions.ts @@ -138,21 +138,31 @@ export const binaryContentTypes = [ export type BodyParametersReducer = ( acc: IDataObject, cur: { name: string; value: string }, -) => IDataObject; +) => Promise; -export const prepareRequestBody = ( +export async function reduceAsync( + arr: T[], + reducer: (acc: Awaited>, cur: T) => Promise, + init: Promise = Promise.resolve({} as R), +): Promise { + return arr.reduce(async (promiseAcc, item) => { + return reducer(await promiseAcc, item); + }, init); +} + +export const prepareRequestBody = async ( parameters: BodyParameter[], bodyType: string, version: number, defaultReducer: BodyParametersReducer, ) => { if (bodyType === 'json' && version >= 4) { - return parameters.reduce((acc, entry) => { - const value = entry.value; - set(acc, entry.name, value); - return acc; - }, {} as IDataObject); + return parameters.reduce(async (acc, entry) => { + const result = await acc; + set(result, entry.name, entry.value); + return result; + }, Promise.resolve({})); } else { - return parameters.reduce(defaultReducer, {}); + return reduceAsync(parameters, defaultReducer); } }; diff --git a/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts b/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts index 2ebf0d7b90..3dd736bbf8 100644 --- a/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts +++ b/packages/nodes-base/nodes/HttpRequest/V3/HttpRequestV3.node.ts @@ -31,6 +31,7 @@ import { binaryContentTypes, getOAuth2AdditionalParameters, prepareRequestBody, + reduceAsync, replaceNullValues, sanitizeUiMessage, } from '../GenericFunctions'; @@ -1161,7 +1162,7 @@ export class HttpRequestV3 implements INodeType { }); } - const parametersToKeyValue = ( + const parametersToKeyValue = async ( accumulator: { [key: string]: any }, cur: { name: string; value: string; parameterType?: string; inputDataFieldName?: string }, ) => { @@ -1171,7 +1172,7 @@ export class HttpRequestV3 implements INodeType { let uploadData: Buffer | Readable; const itemBinaryData = items[itemIndex].binary![cur.inputDataFieldName]; if (itemBinaryData.id) { - uploadData = this.helpers.getBinaryStream(itemBinaryData.id); + uploadData = await this.helpers.getBinaryStream(itemBinaryData.id); } else { uploadData = Buffer.from(itemBinaryData.data, BINARY_ENCODING); } @@ -1192,7 +1193,7 @@ export class HttpRequestV3 implements INodeType { // Get parameters defined in the UI if (sendBody && bodyParameters) { if (specifyBody === 'keypair' || bodyContentType === 'multipart-form-data') { - requestOptions.body = prepareRequestBody( + requestOptions.body = await prepareRequestBody( bodyParameters, bodyContentType, nodeVersion, @@ -1243,7 +1244,7 @@ export class HttpRequestV3 implements INodeType { const itemBinaryData = this.helpers.assertBinaryData(itemIndex, inputDataFieldName); if (itemBinaryData.id) { - uploadData = this.helpers.getBinaryStream(itemBinaryData.id); + uploadData = await this.helpers.getBinaryStream(itemBinaryData.id); const metadata = await this.helpers.getBinaryMetadata(itemBinaryData.id); contentLength = metadata.fileSize; } else { @@ -1264,7 +1265,7 @@ export class HttpRequestV3 implements INodeType { // Get parameters defined in the UI if (sendQuery && queryParameters) { if (specifyQuery === 'keypair') { - requestOptions.qs = queryParameters.reduce(parametersToKeyValue, {}); + requestOptions.qs = await reduceAsync(queryParameters, parametersToKeyValue); } else if (specifyQuery === 'json') { // query is specified using JSON try { @@ -1287,7 +1288,7 @@ export class HttpRequestV3 implements INodeType { if (sendHeaders && headerParameters) { let additionalHeaders: IDataObject = {}; if (specifyHeaders === 'keypair') { - additionalHeaders = headerParameters.reduce(parametersToKeyValue, {}); + additionalHeaders = await reduceAsync(headerParameters, parametersToKeyValue); } else if (specifyHeaders === 'json') { // body is specified using JSON try { diff --git a/packages/nodes-base/nodes/HttpRequest/test/utils/utils.test.ts b/packages/nodes-base/nodes/HttpRequest/test/utils/utils.test.ts index db08844120..991d0061fe 100644 --- a/packages/nodes-base/nodes/HttpRequest/test/utils/utils.test.ts +++ b/packages/nodes-base/nodes/HttpRequest/test/utils/utils.test.ts @@ -2,7 +2,7 @@ import { prepareRequestBody } from '../../GenericFunctions'; import type { BodyParameter, BodyParametersReducer } from '../../GenericFunctions'; describe('HTTP Node Utils, prepareRequestBody', () => { - it('should call default reducer', () => { + it('should call default reducer', async () => { const bodyParameters: BodyParameter[] = [ { name: 'foo.bar', @@ -11,15 +11,13 @@ describe('HTTP Node Utils, prepareRequestBody', () => { ]; const defaultReducer: BodyParametersReducer = jest.fn(); - prepareRequestBody(bodyParameters, 'json', 3, defaultReducer); + await prepareRequestBody(bodyParameters, 'json', 3, defaultReducer); expect(defaultReducer).toBeCalledTimes(1); - expect(defaultReducer).toBeCalledWith({}, { name: 'foo.bar', value: 'baz' }, 0, [ - { name: 'foo.bar', value: 'baz' }, - ]); + expect(defaultReducer).toBeCalledWith({}, { name: 'foo.bar', value: 'baz' }); }); - it('should call process dot notations', () => { + it('should call process dot notations', async () => { const bodyParameters: BodyParameter[] = [ { name: 'foo.bar.spam', @@ -28,7 +26,7 @@ describe('HTTP Node Utils, prepareRequestBody', () => { ]; const defaultReducer: BodyParametersReducer = jest.fn(); - const result = prepareRequestBody(bodyParameters, 'json', 4, defaultReducer); + const result = await prepareRequestBody(bodyParameters, 'json', 4, defaultReducer); expect(defaultReducer).toBeCalledTimes(0); expect(result).toBeDefined(); diff --git a/packages/nodes-base/nodes/Jira/Jira.node.ts b/packages/nodes-base/nodes/Jira/Jira.node.ts index 30fad18fea..ba11ae9340 100644 --- a/packages/nodes-base/nodes/Jira/Jira.node.ts +++ b/packages/nodes-base/nodes/Jira/Jira.node.ts @@ -1058,7 +1058,7 @@ export class Jira implements INodeType { let uploadData: Buffer | Readable; if (binaryData.id) { - uploadData = this.helpers.getBinaryStream(binaryData.id); + uploadData = await this.helpers.getBinaryStream(binaryData.id); } else { uploadData = Buffer.from(binaryData.data, BINARY_ENCODING); } diff --git a/packages/nodes-base/nodes/Slack/V2/SlackV2.node.ts b/packages/nodes-base/nodes/Slack/V2/SlackV2.node.ts index 0ab45d0281..17ece32867 100644 --- a/packages/nodes-base/nodes/Slack/V2/SlackV2.node.ts +++ b/packages/nodes-base/nodes/Slack/V2/SlackV2.node.ts @@ -1059,7 +1059,7 @@ export class SlackV2 implements INodeType { let uploadData: Buffer | Readable; if (binaryData.id) { - uploadData = this.helpers.getBinaryStream(binaryData.id); + uploadData = await this.helpers.getBinaryStream(binaryData.id); } else { uploadData = Buffer.from(binaryData.data, BINARY_ENCODING); } diff --git a/packages/nodes-base/nodes/SpreadsheetFile/v2/SpreadsheetFileV2.node.ts b/packages/nodes-base/nodes/SpreadsheetFile/v2/SpreadsheetFileV2.node.ts index fd87ebd2f4..a749e20e5a 100644 --- a/packages/nodes-base/nodes/SpreadsheetFile/v2/SpreadsheetFileV2.node.ts +++ b/packages/nodes-base/nodes/SpreadsheetFile/v2/SpreadsheetFileV2.node.ts @@ -92,7 +92,7 @@ export class SpreadsheetFileV2 implements INodeType { }, }); if (binaryData.id) { - const stream = this.helpers.getBinaryStream(binaryData.id); + const stream = await this.helpers.getBinaryStream(binaryData.id); await pipeline(stream, parser); } else { parser.write(binaryData.data, BINARY_ENCODING); diff --git a/packages/nodes-base/nodes/Ssh/Ssh.node.ts b/packages/nodes-base/nodes/Ssh/Ssh.node.ts index 853eac060f..565713351f 100644 --- a/packages/nodes-base/nodes/Ssh/Ssh.node.ts +++ b/packages/nodes-base/nodes/Ssh/Ssh.node.ts @@ -441,7 +441,7 @@ export class Ssh implements INodeType { let uploadData: Buffer | Readable; if (binaryData.id) { - uploadData = this.helpers.getBinaryStream(binaryData.id); + uploadData = await this.helpers.getBinaryStream(binaryData.id); } else { uploadData = Buffer.from(binaryData.data, BINARY_ENCODING); } diff --git a/packages/nodes-base/nodes/Telegram/Telegram.node.ts b/packages/nodes-base/nodes/Telegram/Telegram.node.ts index a62e0af2ea..fcc4700f1c 100644 --- a/packages/nodes-base/nodes/Telegram/Telegram.node.ts +++ b/packages/nodes-base/nodes/Telegram/Telegram.node.ts @@ -2005,7 +2005,7 @@ export class Telegram implements INodeType { let uploadData: Buffer | Readable; if (itemBinaryData.id) { - uploadData = this.helpers.getBinaryStream(itemBinaryData.id); + uploadData = await this.helpers.getBinaryStream(itemBinaryData.id); } else { uploadData = Buffer.from(itemBinaryData.data, BINARY_ENCODING); } diff --git a/packages/nodes-base/nodes/WriteBinaryFile/WriteBinaryFile.node.ts b/packages/nodes-base/nodes/WriteBinaryFile/WriteBinaryFile.node.ts index 5ea05ac42e..fb5ea7b1e3 100644 --- a/packages/nodes-base/nodes/WriteBinaryFile/WriteBinaryFile.node.ts +++ b/packages/nodes-base/nodes/WriteBinaryFile/WriteBinaryFile.node.ts @@ -91,7 +91,7 @@ export class WriteBinaryFile implements INodeType { let fileContent: Buffer | Readable; if (binaryData.id) { - fileContent = this.helpers.getBinaryStream(binaryData.id); + fileContent = await this.helpers.getBinaryStream(binaryData.id); } else { fileContent = Buffer.from(binaryData.data, BINARY_ENCODING); } diff --git a/packages/workflow/src/Interfaces.ts b/packages/workflow/src/Interfaces.ts index 188c05a159..ea22e7bdf4 100644 --- a/packages/workflow/src/Interfaces.ts +++ b/packages/workflow/src/Interfaces.ts @@ -687,7 +687,7 @@ export interface BinaryHelperFunctions { copyBinaryFile(): Promise; binaryToBuffer(body: Buffer | Readable): Promise; getBinaryPath(binaryDataId: string): string; - getBinaryStream(binaryDataId: string, chunkSize?: number): Readable; + getBinaryStream(binaryDataId: string, chunkSize?: number): Promise; getBinaryMetadata(binaryDataId: string): Promise<{ fileName?: string; mimeType?: string;