turbo_zip 1.0.1
turbo_zip: ^1.0.1 copied to clipboard
Library containing various algorithms for encoding and decoding text and numbers
TurboZip 🚀🤐 #
A dart library containing various algorithms for encoding and decoding text and numbers with compression.
Quick Links #
Installation #
You can directly install TurboZip by adding turbo_zip: ^1.0.1 to your pubspec.yaml dependencies section
You can also add TurboZip to your project by executing,
- For Flutter Project -
flutter pub add turbo_zip - For Dart Project -
dart pub add turbo_zip
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.
Here is how you can use LZW in your code,
import 'package:turbo_zip/turbo_zip.dart';
final String originalText = "TO BE OR NOT TO BE OR TO BE OR NOT";
final List<int> encodedText = LZW.encode(originalText);
print("Encoded Text : $encodedText");
final String decodedText = LZW.decode(encodedText);
print("Decoded Text: $decodedText");
print(originalText == decodedText); // true
👉 Note: Unicode characters like emojis are currently not supported by
LZW. Keep in mind to handle exceptions thrown by bothencodeanddecodefunctions 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.
Contributing #
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. Happy Coding 🤝!