Merge pull request #1651 from n8n-io/link-cookbook

add more info to binary buffer
This commit is contained in:
Deborah 2023-10-11 11:36:39 +01:00 committed by GitHub
commit dba4a57522
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,19 @@ The binary data buffer contains all the binary file data processed by a workflow
You can access the buffer using n8n's `getBinaryDataBuffer()` function:
```js
/*
* itemIndex: number. The index of the item in the input data.
* binaryPropertyName: string. The name of the binary property.
* The default in the Read Binary Files node is 'data'.
*/
let binaryDataBufferItem = await this.helpers.getBinaryDataBuffer(itemIndex, binaryPropertyName);
```
You should always use the `getBinaryDataBuffer()` function, and avoid using older methods of directly accessing the buffer, such as targeting it with expressions like `items[0].binary.data.data`.
For example:
```js
let binaryDataBufferItem = await this.helpers.getBinaryDataBuffer(0, 'data');
// Returns the data in the binary buffer for the first input item
```
You should always use the `getBinaryDataBuffer()` function, and avoid using older methods of directly accessing the buffer, such as targeting it with expressions like `items[0].binary.data.data`.