mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -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 type { IExecuteFunctions } from 'n8n-core';
|
||||||
|
import { BINARY_ENCODING } from 'n8n-core';
|
||||||
|
import type { Readable } from 'stream';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
|
@ -1072,18 +1073,21 @@ export class SlackV2 implements INodeType {
|
||||||
{ itemIndex: i },
|
{ itemIndex: i },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const binaryDataBuffer = await this.helpers.getBinaryDataBuffer(
|
let uploadData: Buffer | Readable;
|
||||||
i,
|
const itemBinaryData = items[i].binary![binaryPropertyName];
|
||||||
binaryPropertyName,
|
if (itemBinaryData.id) {
|
||||||
);
|
uploadData = this.helpers.getBinaryStream(itemBinaryData.id);
|
||||||
|
} else {
|
||||||
|
uploadData = Buffer.from(itemBinaryData.data, BINARY_ENCODING);
|
||||||
|
}
|
||||||
body.file = {
|
body.file = {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
value: binaryDataBuffer,
|
value: uploadData,
|
||||||
options: {
|
options: {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
filename: items[i].binary[binaryPropertyName].fileName,
|
filename: itemBinaryData.fileName,
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
contentType: items[i].binary[binaryPropertyName].mimeType,
|
contentType: itemBinaryData.mimeType,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
responseData = await slackApiRequest.call(
|
responseData = await slackApiRequest.call(
|
||||||
|
|
Loading…
Reference in a new issue