Binary.Buffer
BinaryBuffers a binary value in memory, producing a stable value with deterministic length and byte order.
Syntax
Binary.Buffer(binary as nullable binary) as nullable binaryParameters
| Name | Type | Required | Description |
|---|---|---|---|
binary | binary | Yes | The binary value to buffer in memory. |
Return Value
binary — A stable, fully materialized copy of the binary value in memory.
Remarks
Binary.Buffer loads a binary value entirely into memory, producing a stable binary with a deterministic length and byte order. Streaming binary values from external sources (such as files or HTTP responses) may be lazily evaluated and can change between reads. Buffering ensures the value is read once and reused consistently.
Use this function when a binary value is accessed multiple times in a query and you want to avoid redundant reads from the source. However, be mindful of memory usage for large binary values.
Examples
Example 1: Create a stable version of a binary value
let
Source = Binary.FromList({0..10}),
Buffered = Binary.Buffer(Source),
AsList = Binary.ToList(Buffered)
in
AsListConverts the buffered binary back to a list of numbers to verify the content.
Value | |
|---|---|
| 1 | {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10} |