README.md

# divingbells


[![build](https://gitlab.com/erlang-dev/divingBells/badges/main/pipeline.svg)](https://gitlab.com/erlang-dev/divingBells/-/pipelines)
[![codecov](https://codecov.io/gl/erlang-dev/divingBells/graph/badge.svg?token=J4K1FZSIAL)](https://codecov.io/gl/erlang-dev/divingBells)
[![Release](https://gitlab.com/erlang-dev/divingBells/-/badges/release.svg)](https://gitlab.com/erlang-dev/divingBells/-/releases)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg?logo=apache&logoColor=red)](https://www.apache.org/licenses/LICENSE-2.0)
[![Documentation](https://img.shields.io/badge/Documentation-@hex.pm-purple)](https://hexdocs.pm/divingBells/index.html)


`divingbells` is a escript for compressing and decompressing single file, files (WIP), and directories (WIP)
by using huffman coding or huffman coding-like algorithm.

## Installation

### Rebar3

`divingbells` is built using [rebar3](https://rebar3.readme.io/docs/getting-started),
if this library is used with rebar3 simply put it in your rebar.config file:

```
{deps, [
    divingbells
    ]}.
```

### Other

If you don't use rebar3 it's possibly to get the latest version from [gitlab](https://gitlab.com/erlang-dev/divingBells/-/releases)


## Build

```
$ rebar3 compile
$ rebar3 escriptize
```
The escript is generated at `<project-root>/_build/default/bin/divingbells`.
Copy the executable `divingbells` and put it in your `PATH` in order to use it.

## Test

To run the tests call eunit via rebar3

```
$ rebar3 eunit
```

## Usage


### Configuration

The escript is primarly intended to be used through CLI.
The following configurations can be used

```
 -C, --compress              compress FILE
 -D, --decompress            decompress FILE
 -f, --file                  FILE to compress or decomress
 -d, --destination-file      file to write the result to
 -h, --help                  print this help
```

### Example
```
$ ls
divingbells  example.txt
$ ./divingbells -C -f example.txt
$ ls
divingbells example.txt example.txt.dbc
$ ./divingbells -D -f example.txt.dbc -d example.text
$ ls
divingbells example.text example.txt example.txt.dbc
$ cat example.text
hello world
```