Binary.Decompress

D

T

The M Code Behind the Power Query M function Binary.Decompress

The Binary.Decompress function takes two arguments: the compressed binary data and an optional encoding type. The encoding type argument is optional because the function can automatically detect the encoding type of the compressed data.

How Binary.Decompress Works

The Binary.Decompress function uses the DEFLATE algorithm to decompress the binary data. The DEFLATE algorithm is a lossless compression algorithm that is commonly used to compress data for storage or transmission.

The DEFLATE algorithm works by analyzing the input data and replacing repeated patterns with references to previously-encountered patterns. This allows the algorithm to achieve high compression ratios while retaining the original data without loss.

The Binary.Decompress function takes the compressed binary data as input and applies the DEFLATE algorithm to it. The resulting output is the decompressed data in binary format.

Example Usage

Suppose we have a compressed binary file containing data that we want to analyze using Power Query. We can use the Binary.Decompress function to decompress the file and load the data into Power Query for further analysis.

Here is an example of how to use the Binary.Decompress function in Power Query:


let

compressedData = Binary.Buffer(File.Contents("C:compressedData.bin")),

decompressedData = Binary.Decompress(compressedData),

outputTable = Table.FromBinary(decompressedData)

in

outputTable


In this example, we first load the compressed binary data from a file using the File.Contents function. We then use the Binary.Buffer function to store the data in memory as a binary buffer.

Next, we pass the binary buffer to the Binary.Decompress function to decompress the data. Finally, we use the Table.FromBinary function to convert the decompressed binary data into a Power Query table for analysis.

The Binary.Decompress function is a powerful tool for working with compressed binary data in Power Query. By using this function, you can easily decompress data for analysis without the need for external tools or libraries.

In summary, the Binary.Decompress function works by applying the DEFLATE algorithm to compressed binary data. The resulting output is the decompressed data in binary format, which can be easily loaded into Power Query for analysis and processing.

Power Query and M Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)