espressif/xz

1.0.0

uploaded 1 year ago
xz decompression utility

readme

# XZ decompress utility

[![Component Registry](https://components.espressif.com/components/espressif/xz/badge.svg)](https://components.espressif.com/components/espressif/xz)

This component provides the XZ decompress utility based on [XZ Embedded](https://tukaani.org/xz/embedded.html). API `xz_decompress` is public to use, for more info about this API, please refer to [link](https://github.com/espressif/esp-iot-solution/tree/master/components/utilities/xz/include/xz_decompress.h).

## Add to project

You can add this component to your project via `idf.py add-dependancy`, e.g.

```shell
idf.py add-dependency xz==1.0.0
```

Alternatively, you can create the manifest idf_component.yml in the project's main component directory.

```yml
dependencies:
  espressif/xz: "^1.0.0"
```

More is in [Espressif's documentation](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/tools/idf-component-manager.html).

## Example

- [examples/utilities/xz_decompress_file](https://github.com/espressif/esp-iot-solution/tree/master/examples/utilities/xz_decompress_file): This example is based on this component.

You can create a project from this example by the following command:

```shell
idf.py create-project-from-example "espressif/xz^1.0.0:xz_decompress_file"
```

> Note: For the examples downloaded by using this command, you need to comment out the `override_path` line in the main/idf_component.yml.

changelog

# ChangeLog

## v1.0.0 - 2023-2-10

First release version.

- Support xz_decompress

readme of xz_decompress_file example

                                        
                                        # XZ Decompress Example

This example demonstrates how to use function `xz_decompress()` to decompress the specified file.
The `xz_decompress()` is based on the `XZ Embedded` library, for more information about `XZ Embedded`, please refer to [XZ Embeded](https://tukaani.org/xz/embedded.html).

### Generate the Compressed File

> Note:
> Please install **xz** tool based on your operation system, this part will not be described here, please google it if needed.

To compress the specified file, use the following command:

```shell
xz --check=crc32 --lzma2=dict=8KiB -k file_name
```

Use `xz -h` to get more information about how to use `xz` command to compress the specified file.

In this example, we use the following command to compress `test_file/hello.txt`:

```
xz --check=crc32 --lzma2=dict=8KiB -k test_file/hello.txt
```

### Build and flash

To run the example, type the following command:

```
idf.py -p PORT flash monitor
```

(To exit the serial monitor, type ``Ctrl-]``.)

See the Getting Started Guide for full steps to configure and use [ESP-IDF](https://github.com/espressif/esp-idf) to build projects.

## Example output

Here is the example's console output:

```
...
I (309) xz decompress: origin file size is 393, compressed file size is 93 bytes

I (319) xz decompress: *****************test buf to buf begin****************

I (329) xz decompress: decompress data:
Hello World!Hello Everyone!
Hello World!Hello Everyone!
Hello World!Hello Everyone!
Hello World!Hello Everyone!
Hello World!Hello Everyone!
Hello World!Hello Everyone!
Hello World!Hello Everyone!
Hello World!Hello Everyone!
Hello World!Hello Everyone!
Hello World!Hello Everyone!
Hello World!Hello Everyone!
Hello World!Hello Everyone!
Hello World!Hello Everyone!
Hello World!Hello Everyone!

I (369) xz decompress: ret = 0, decompressed count is 92
I (369) xz decompress: *****************test buf to buf end******************
```

                                    

Links

Supports all targets

License: Apache-2.0

To add this component to your project, run:

idf.py add-dependency "espressif/xz^1.0.0"

or download archive

Dependencies

  • ESP-IDF >=4.1
  • Examples:

    xz_decompress_file

    more details

    To create a project from this example, run:

    idf.py create-project-from-example "espressif/xz^1.0.0:xz_decompress_file"

    or download archive

    Stats

    • Downloaded in total
      Downloaded in total 15.7k times
    • Downloaded this version
      This version: 15.7k times

    Badge

    espressif/xz version: 1.0.0
    |