Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
eelmafia committed Oct 3, 2024
1 parent 9c62a1d commit fad7848
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# GleamLZ_String

[![Package Version](https://img.shields.io/hexpm/v/gleamlz_string)](https://hex.pm/packages/gleamlz_string)
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/gleamlz_string/)

### This is a Gleam implementation of the [lz-string](https://github.com/pieroxy/lz-string) compression algorithm

### Installation
```sh
gleam add TODO:
gleam add gleamlz_string
```
### Usage
```gleam
Expand All @@ -16,40 +20,34 @@ pub fn main() {
gleamlz_string.compress_to_uint8(string)
//<<4, 133, 48, 54, 96, 246, 0, 64, 234, 144, 39, 48, 4, 192, 132, 64>>
gleamlz_string.decompress_from_uint8(<<4, 133, 48, 54, 96, 246, 0, 64, 234, 144, 39, 48, 4, 192, 132, 64>>)
//"Hello World!
//Ok("Hello World!)
//Base64
gleamlz_string.compress_to_base64(string)
//"BIUwNmD2AEDqkCcwBMCEQA=="
gleamlz_string.decompress_from_base64("BIUwNmD2AEDqkCcwBMCEQA==")
//"Hello World"
//Ok("Hello World")
//URI encoded
gleamlz_string.compress_to_encoded_uri(string)
//"BIUwNmD2AEDqkCcwBMCEQA$$"
gleamlz_string.decompress_from_encoded_uri("BIUwNmD2AEDqkCcwBMCEQA$$")
//"Hello World!"
//Ok("Hello World!")
}
```

### Note

TODO:

- [ ] Add `compress_to_utf16`
- [ ] Add tests for `base64` and `encoded_uri`
- [ ] Add tests to automatically compare with the JavaScript version of LZ_String
- [ ] Finish README
- [ ] Add Documentation
### Testing
Run `generate_testcases.sh` first which will generate a bunch of test data using the base JavaScript lib to compare with.
Once that's done run `gleam test`

### Docs
TODO
https://hexdocs.pm/gleamlz_string/

### Acknowledgements
[Original LZ_String by Pieroxy](https://github.com/pieroxy/lz-string)

Used [Michael Shapiro's elixir verson](https://github.com/koudelka/elixir-lz-string/tree/master) as reference

### License
[Apache 2.0](./LICENSE)
[Apache 2.0](./LICENSE)
4 changes: 2 additions & 2 deletions gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "gleamlz_string"
version = "1.0.0"
version = "1.0.1"

target = "erlang"

Expand All @@ -12,7 +12,7 @@ links = [{ title = "Gleam", href = "https://gleam.run" }]
[dependencies]
gleam_stdlib = ">= 0.34.0 and < 2.0.0"
gleam_erlang = ">= 0.26.0 and < 1.0.0"
file_streams = ">= 1.1.1 and < 2.0.0"

[dev-dependencies]
gleeunit = ">= 1.0.0 and < 2.0.0"
file_streams = ">= 1.1.1 and < 2.0.0"

0 comments on commit fad7848

Please sign in to comment.