Binary.Split

Binary

Splits a binary value into a list of binary chunks of a specified page size.

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

Syntax

Binary.Split(binary as binary, pageSize as number) as list

Parameters

NameTypeRequiredDescription
binarybinaryYesThe binary value to split into chunks.
pageSizenumberYesThe number of bytes per chunk. The last chunk may contain fewer bytes if the total is not evenly divisible.

Return Value

listA list of binary values, each containing up to pageSize bytes.

Remarks

Binary.Split divides a binary value into a list of binary chunks, where each chunk contains up to pageSize bytes. The first element contains the first pageSize bytes, the second element the next pageSize bytes, and so on. The final chunk may be smaller if the total byte count is not evenly divisible by pageSize.

This function is useful for processing large binary streams in fixed-size pages, such as when uploading binary data in chunks or implementing paged binary protocols.

Examples

Example 1: Split a binary into chunks of 3 bytes

let
    Source = Binary.FromList({0..9}),
    Chunks = Binary.Split(Source, 3),
    ChunkSizes = List.Transform(Chunks, each Binary.Length(_))
in
    ChunkSizes
Applied Steps

Returns the byte lengths of each chunk: {3, 3, 3, 1}.

Value
1{3, 3, 3, 1}

Compatibility

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