diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0999dcc --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Aditya Motale + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 8b55e73..7530081 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,63 @@ - +A dart library containing various algorithms for encoding and decoding text and numbers with compression. -TODO: Put a short description of the package here that helps potential users -know whether this package might be useful for them. +## Quick Links -## Features +- [Installation](#installation) +- [Algorithms](#algorithms) +- [Contributing](#contributing) -TODO: List what your package can do. Maybe include images, gifs, or videos. +## Installation -## Getting started +You can directly install `TurboZip` by adding `turbo_zip: ^1.0.0` to your _pubspec.yaml_ dependencies section -TODO: List prerequisites and provide or point to information on how to -start using the package. +You can also add `TurboZip` to your project by executing, -## Usage +- For Flutter Project - `flutter pub add turbo_zip` +- For Dart Project - `dart pub add turbo_zip` -TODO: Include short and useful examples for package users. Add longer examples -to `/example` folder. +## Algorithms + +### LZW (Lempel-Ziv-Welch) + +LZW compresses data by replacing repeated substrings with shorter codes, creating a dictionary +dynamically during encoding. It's a lossless method used in _GIF Images_ and _Unix File_ compression. + +_LZW_ performs significantly faster then GZip in dart code. Have a look at +[benchmark results](./benchmarks/lzw/results.txt). + +Here is how you can use `LZW` in your code, ```dart -const like = 'sample'; +import 'package:turbo_zip/turbo_zip.dart'; + +final String originalText = "TO BE OR NOT TO BE OR TO BE OR NOT"; + +final List encodedText = LZW.encode(originalText); +print("Encoded Text : $encodedText"); + +final String decodedText = LZW.decode(encodedText); +print("Decoded Text: $decodedText"); + +print(originalText == decodedText); // true ``` -## Additional information +> 👉 Note: Unicode characters like emojis are currently not supported by `LZW`. Keep in mind to handle exceptions thrown by both `encode` and `decode` functions of _LZW_ in your code. + +## Benchmarks + +To benchmark `turbo_zip` algorithms against industry leading algorithms, dart scripts are created in +`./benchmarks/`. Check them out [here](./benchmarks/). + +## Contributing -TODO: Tell users more about the package: where to find more information, how to -contribute to the package, how to file issues, what response they can expect -from the package authors, and more. +PR's and Issues are open! If you'd like to improve `TurboZip`, please open an issue or an PR with +your suggested changes in this [repo](https://github.com/AdityaMotale/turbo_zip). Happy Coding 🤝!