mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
✨ Initial changes for binary data management (#2105)
* introduce binary data management * cr * add binary data changes to awsS3 node * add binary data changes to Box node * add binary data changes to CiscoWebex node * add binary data changes to HumaniticAi node * add binary data changes to Jira node * add binary data changes to Line node * add binary data changes to MicrosoftOneDrive node * add binary data changes to MicrosoftOutlook node * add binary data changes to Mindee node * add binary data changes to NocoDB node * add binary data changes to Pushbullet node * add binary data changes to Pushover node * add binary data changes to Raindrop node * add binary data changes to S3 node * add binary data changes to Salesforce node * add binary data changes to Ssh node * add binary data changes to TheHive node * add binary data changes to Twist node * add binary data changes to Twitter node * remove changes not needed right now * 🐛 Fix issue with multiple runs * 🐛 Revert fix and add support for multiple inputs Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -3,7 +3,6 @@ import {
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
BINARY_ENCODING,
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
IHookFunctions,
|
||||
@@ -96,7 +95,8 @@ export async function uploadAttachments(this: IExecuteFunctions, binaryPropertie
|
||||
let attachmentBody = {};
|
||||
let response: IDataObject = {};
|
||||
|
||||
const isAnimatedWebp = (Buffer.from(binaryData[binaryPropertyName].data, 'base64').toString().indexOf('ANMF') !== -1);
|
||||
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
||||
const isAnimatedWebp = (dataBuffer.toString().indexOf('ANMF') !== -1);
|
||||
|
||||
const isImage = binaryData[binaryPropertyName].mimeType.includes('image');
|
||||
|
||||
@@ -118,9 +118,11 @@ export async function uploadAttachments(this: IExecuteFunctions, binaryPropertie
|
||||
|
||||
// https://developer.twitter.com/en/docs/media/upload-media/api-reference/post-media-upload-init
|
||||
|
||||
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryPropertyName);
|
||||
|
||||
attachmentBody = {
|
||||
command: 'INIT',
|
||||
total_bytes: Buffer.from(binaryData[binaryPropertyName].data, BINARY_ENCODING).byteLength,
|
||||
total_bytes: dataBuffer.byteLength,
|
||||
media_type: binaryData[binaryPropertyName].mimeType,
|
||||
};
|
||||
|
||||
@@ -130,7 +132,7 @@ export async function uploadAttachments(this: IExecuteFunctions, binaryPropertie
|
||||
|
||||
// break the data on 5mb chunks (max size that can be uploaded at once)
|
||||
|
||||
const binaryParts = chunks(Buffer.from(binaryData[binaryPropertyName].data, BINARY_ENCODING), 5242880);
|
||||
const binaryParts = chunks(dataBuffer, 5242880);
|
||||
|
||||
let index = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user