Binary.Buffer
A binary read once and kept in memory, so later steps don't fetch it from its source again.
Group: Binary and lines. Power Query M has it too: a query that uses it is written as in Power BI.
Syntax
Binary.Buffer(binary as nullable binary) as nullable binary
| Parameter | Type | Description |
|---|---|---|
binary | nullable binary | The bytes to hold, such as a file's or a web address's contents. |
Returns
nullable binary. The same bytes; null when the binary is null.
Remarks
- Use it when several steps read the same file or download: the file is read, or the address asked, once.
- The bytes are held in memory, so keep it for files of a reasonable size.
Examples
The same bytes back
Binary.Buffer(Text.ToBinary("Oslo"))
#binary({79, 115, 108, 111})
Read once, used twice
let
Bytes = Binary.Buffer(Text.ToBinary("Oslo#(lf)Bergen"))
in
{Binary.Length(Bytes), Lines.FromBinary(Bytes)}
{11, {"Oslo", "Bergen"}}
The size in bytes and the lines, both from the one copy in memory.