From e059063aea7573e2a0f93bf3353a742933ba8bb9 Mon Sep 17 00:00:00 2001 From: Deborah Barnard Date: Wed, 11 Oct 2023 11:29:57 +0100 Subject: [PATCH] add more info to binary buffer --- .../cookbook/code-node/get-binary-data-buffer.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/code/cookbook/code-node/get-binary-data-buffer.md b/docs/code/cookbook/code-node/get-binary-data-buffer.md index 2de5b8b52..cc74bc433 100644 --- a/docs/code/cookbook/code-node/get-binary-data-buffer.md +++ b/docs/code/cookbook/code-node/get-binary-data-buffer.md @@ -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`. \ No newline at end of file +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`.