-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: updated version and workflows
- Loading branch information
1 parent
9878363
commit 658ccb3
Showing
6 changed files
with
127 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## 1.3.24 | ||
## 1.4.0 | ||
|
||
* Fixed decompression size. | ||
* Added `compressionLevel` parameter. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,140 @@ | ||
[![pub package](https://img.shields.io/pub/v/zstandard.svg)](https://pub.dev/packages/zstandard) | ||
[![pub package](https://img.shields.io/pub/v/zstandard.svg)](https://pub.dev/packages/zstandard) | ||
[![pub package](https://img.shields.io/pub/v/zstandard_cli.svg)](https://pub.dev/packages/zstandard_cli) | ||
|
||
# Zstandard | ||
|
||
Zstandard (zstd) is a fast, high-compression algorithm developed by Meta (formerly Facebook) designed for real-time compression scenarios. It provides a flexible range of compression levels, allowing both high-speed and high-ratio compression, making it ideal for applications with diverse performance needs. Zstandard is commonly used in data storage, transmission, and backup solutions. | ||
Zstandard (zstd) is a fast, high-compression algorithm developed by Meta (formerly Facebook) designed for real-time compression scenarios. It offers a flexible range of compression levels, allowing both high-speed and high-ratio compression, making it ideal for applications with diverse performance needs. Zstandard is widely used in data storage, transmission, and backup solutions. | ||
|
||
This is a Flutter plugin that provides a pure implementation of the zstd compression algorithm, developed by Meta. It integrates the zstd library in C through FFI for native platforms, ensuring efficient compression and decompression. For web platforms, it leverages WebAssembly to deliver the same robust compression capabilities. This plugin enables seamless, cross-platform data compression, making it ideal for applications requiring high-speed and efficient data processing. | ||
This repository contains a federated Flutter plugin and a CLI package for `zstandard` compression, enabling both in-app and command-line usage. The two main components are: | ||
|
||
| | Android | iOS | [Web](https://flutter.dev/web) | [macOS](https://flutter.dev/desktop) | [Windows](https://flutter.dev/desktop) | [Linux](https://flutter.dev/desktop) | [Fuchsia](https://fuchsia.dev/) | | ||
|:-----------:|:------------------:|:------------------:|:------------------------------:|:------------------------------------:|:--------------------------------------:|:------------------------------------:|:-------------------------------:| | ||
| Status | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | ❌ | | ||
| Native | FFI | FFI | WebAssembly | FFI | FFI | FFI | ❌ | | ||
| Precompiled | No | No | Yes (wasm) | No | No | No | ❌ | | ||
- **[zstandard](https://pub.dev/packages/zstandard):** A Flutter plugin for cross-platform compression, supporting mobile, desktop, and web platforms. This package integrates the zstd library through FFI for native platforms and WebAssembly for the web, allowing efficient data compression in any Flutter environment. | ||
|
||
- **[zstandard_cli](https://pub.dev/packages/zstandard_cli):** A pure Dart package providing CLI capabilities for macOS, Windows, and Linux. It enables command-line compression and decompression for data files and streams. | ||
|
||
> The C files to build the compression library come from the original [facebook/zstd](https://github.com/facebook/zstd/tree/dev/lib) repository. | ||
> **Note:** The `zstandard` plugin is designed for use in Flutter applications. For pure Dart applications or CLI usage, refer to the `zstandard_cli` package. | ||
## Usage | ||
--- | ||
|
||
## Compatibility | ||
|
||
| | [Android](https://flutter.dev) | [iOS](https://developer.apple.com/ios/) | [Web](https://flutter.dev/web) | [macOS](https://flutter.dev/desktop) | [Windows](https://flutter.dev/desktop) | [Linux](https://flutter.dev/desktop) | [Fuchsia](https://fuchsia.dev/) | | ||
|:-----------:|:------------------------------:|:--------------------------------------:|:-------------------------------------:|:------------------------------------:|:--------------------------------------:|:------------------------------------:|:-------------------------------:| | ||
| Flutter | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: (wasm) | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | ❌ | | ||
| Native | FFI | FFI | WebAssembly | FFI | FFI | FFI | ❌ | | ||
| Precompiled | No | No | Yes | No | No | No | ❌ | | ||
|
||
| | [macOS](https://flutter.dev/desktop) | [Windows](https://flutter.dev/desktop) | [Linux](https://flutter.dev/desktop) | | ||
|:-----------:|:------------------------------------:|:--------------------------------------:|:------------------------------------:| | ||
| CLI | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | ||
| arm64 | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | | ||
| Precompiled | Yes | Yes | Yes | | ||
|
||
--- | ||
|
||
## Basic Usage | ||
|
||
### In-App (Flutter) | ||
|
||
```dart | ||
void act() async { | ||
import 'package:zstandard/zstandard.dart'; | ||
void main() async { | ||
final zstandard = Zstandard(); | ||
Uint8List original = Uint8List.fromList([...]); | ||
Uint8List originalData = Uint8List.fromList([...]); | ||
Uint8List? compressed = await zstandard.compress(original); | ||
Uint8List? compressed = await zstandard.compress(originalData); | ||
Uint8List? decompressed = await zstandard.decompress(compressed ?? Uint8List(0)); | ||
} | ||
``` | ||
|
||
With extension functions: | ||
Using extensions: | ||
|
||
```dart | ||
void act() async { | ||
Uint8List original = Uint8List.fromList([...]); | ||
import 'package:zstandard/zstandard.dart'; | ||
void main() async { | ||
Uint8List originalData = Uint8List.fromList([...]); | ||
Uint8List? compressed = await original.compress(); | ||
Uint8List? compressed = await originalData.compress(); | ||
Uint8List? decompressed = await compressed.decompress(); | ||
} | ||
``` | ||
|
||
<p align="center"><img width="50%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_android/images/sample.png"></p> | ||
### Command Line (zstandard_cli) | ||
|
||
<p align="center"><img width="50%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_ios/images/sample.png"></p> | ||
```bash | ||
# Compress a file with a specified compression level | ||
dart run zstandard_cli:compress myfile.txt 3 | ||
|
||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_macos/images/sample.png"></p> | ||
# Decompress a file | ||
dart run zstandard_cli:decompress myfile.txt.zstd | ||
``` | ||
|
||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_web/images/sample.png"></p> | ||
#### Dart Code Example (CLI) | ||
|
||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_windows/images/sample.png"></p> | ||
```dart | ||
import 'package:zstandard_cli/zstandard_cli.dart'; | ||
void main() async { | ||
var cli = ZstandardCLI(); | ||
final originalData = Uint8List.fromList([...]); | ||
final compressed = await cli.compress(originalData, compressionLevel: 3); | ||
final decompressed = await cli.decompress(compressed ?? Uint8List(0)); | ||
} | ||
``` | ||
|
||
Using extensions in Dart: | ||
|
||
```dart | ||
import 'package:zstandard_cli/zstandard_cli.dart'; | ||
void main() async { | ||
final originalData = Uint8List.fromList([...]); | ||
final compressed = await originalData.compress(compressionLevel: 3); | ||
final decompressed = await compressed.decompress(); | ||
} | ||
``` | ||
|
||
--- | ||
|
||
## Screenshots | ||
|
||
### Compression and Decompression Samples | ||
|
||
#### macOS | ||
|
||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_cli/images/macos_compression_sample.png"></p> | ||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_cli/images/macos_decompression_sample.png"></p> | ||
|
||
#### Windows | ||
|
||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_cli/images/windows_compression_sample.png"></p> | ||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_cli/images/windows_decompression_sample.png"></p> | ||
|
||
#### Linux | ||
|
||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_cli/images/linux_compression_sample.png"></p> | ||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_cli/images/linux_decompression_sample.png"></p> | ||
|
||
#### Flutter Plugin (Android, iOS, macOS, Web, Windows, Linux) | ||
|
||
<p align="center"><img width="50%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_android/images/sample.png"></p> | ||
<p align="center"><img width="50%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_ios/images/sample.png"></p> | ||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_macos/images/sample.png"></p> | ||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_web/images/sample.png"></p> | ||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_windows/images/sample.png"></p> | ||
<p align="center"><img width="90%" vspace="10" src="https://github.com/landamessenger/zstandard/raw/master/zstandard_linux/images/sample.png"></p> | ||
|
||
--- | ||
|
||
## License | ||
|
||
This project uses code from the original [facebook/zstd](https://github.com/facebook/zstd/tree/dev/lib) repository. Please see the LICENSE file for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
## 1.3.24 | ||
## 1.4.0 | ||
|
||
* Fixed decompression size. | ||
* Added `compressionLevel` parameter. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters