Binary.Buffer

Binary

Buffers a binary value in memory, producing a stable value with deterministic length and byte order.

Examples on this page use shared sample tables. View them to understand the input data before reading the examples below.

Syntax

Binary.Buffer(binary as nullable binary) as nullable binary

Parameters

NameTypeRequiredDescription
binarybinaryYesThe binary value to buffer in memory.

Return Value

binaryA 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
    AsList
Applied Steps

Converts 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}

Compatibility

Power BI Desktop Power BI Service Excel Desktop Excel Online Dataflows Fabric Notebooks