Binary.Split
BinarySplits a binary value into a list of binary chunks of a specified page size.
Syntax
Binary.Split(binary as binary, pageSize as number) as listParameters
| Name | Type | Required | Description |
|---|---|---|---|
binary | binary | Yes | The binary value to split into chunks. |
pageSize | number | Yes | The number of bytes per chunk. The last chunk may contain fewer bytes if the total is not evenly divisible. |
Return Value
list — A 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
ChunkSizesApplied 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