Binary.Decompress
BinaryDecompresses a binary value using the specified compression type (GZip or Deflate).
Syntax
Binary.Decompress(binary as nullable binary, compressionType as number) as nullable binaryParameters
| Name | Type | Required | Description |
|---|---|---|---|
binary | binary | Yes | The compressed binary value to decompress. |
compressionType | number | Yes | The compression algorithm that was used: Compression.GZip or Compression.Deflate. |
Return Value
binary — A decompressed copy of the input binary value.
Remarks
Binary.Decompress decompresses a binary value using the specified compression algorithm. The result is a decompressed copy of the input. Supported compression types are:
Compression.GZip— GZip decompression (RFC 1952). Use this when the input was compressed with GZip.Compression.Deflate— Deflate decompression (RFC 1951). Use this when the input was compressed with raw Deflate.
The compressionType must match the algorithm originally used to compress the data. Use Binary.Compress with the same type to perform the reverse operation.
Examples
Example 1: Decompress a Deflate-compressed binary
let
Compressed = #binary({115, 103, 200, 7, 194, 20, 134, 36, 134, 74, 134, 84, 6, 0}),
Decompressed = Binary.Decompress(Compressed, Compression.Deflate),
AsList = Binary.ToList(Decompressed)
in
AsListApplied Steps
Converts the decompressed binary to a list of byte values for inspection. The bytes represent the UTF-16 LE encoding of "Goodbye".
Value | |
|---|---|
| 1 | {71, 0, 111, 0, 111, 0, 100, 0, 98, 0, 121, 0, 101, 0} |
Example 2: Round-trip compress and decompress
let
Original = Binary.FromList({1, 2, 3, 4, 5}),
Compressed = Binary.Compress(Original, Compression.GZip),
Decompressed = Binary.Decompress(Compressed, Compression.GZip),
AsList = Binary.ToList(Decompressed)
in
AsListApplied Steps
Converts the decompressed binary back to a list, confirming the round-trip produced {1, 2, 3, 4, 5}.
Value | |
|---|---|
| 1 | {1, 2, 3, 4, 5} |
Compatibility
✓ Power BI Desktop✓ Power BI Service✓ Excel Desktop✓ Excel Online✓ Dataflows✓ Fabric Notebooks