mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
feat(Slack Node): Move from Binary Buffer to Binary streaming (#5612)
✨ Add Binary streaming instead of binary buffering
This commit is contained in:
parent
e949db3525
commit
9420b0fdf8
|
@ -1,5 +1,6 @@
|
|||
/* eslint-disable n8n-nodes-base/node-filename-against-convention */
|
||||
import type { IExecuteFunctions } from 'n8n-core';
|
||||
import { BINARY_ENCODING } from 'n8n-core';
|
||||
import type { Readable } from 'stream';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
|
@ -1072,18 +1073,21 @@ export class SlackV2 implements INodeType {
|
|||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(
|
||||
i,
|
||||
binaryPropertyName,
|
||||
);
|
||||
let uploadData: Buffer | Readable;
|
||||
const itemBinaryData = items[i].binary![binaryPropertyName];
|
||||
if (itemBinaryData.id) {
|
||||
uploadData = this.helpers.getBinaryStream(itemBinaryData.id);
|
||||
} else {
|
||||
uploadData = Buffer.from(itemBinaryData.data, BINARY_ENCODING);
|
||||
}
|
||||
body.file = {
|
||||
//@ts-ignore
|
||||
value: binaryDataBuffer,
|
||||
value: uploadData,
|
||||
options: {
|
||||
//@ts-ignore
|
||||
filename: items[i].binary[binaryPropertyName].fileName,
|
||||
filename: itemBinaryData.fileName,
|
||||
//@ts-ignore
|
||||
contentType: items[i].binary[binaryPropertyName].mimeType,
|
||||
contentType: itemBinaryData.mimeType,
|
||||
},
|
||||
};
|
||||
responseData = await slackApiRequest.call(
|
||||
|
|
Loading…
Reference in a new issue