zstandard 패키지는 Android, iOS, Linux, macOS, Web 및 Windows 포함 다중 플랫폼에서 Flutter 애플리케이션을 위한 고성능 Zstandard 압축 및 해제 기능을 제공합니다. 원격 구현과 WebAssembly를 활용하여 실시간 또는 대규모 데이터 처리에 적합한 빠르고 효율적인 데이터 압축을 제공합니다. 이 플러그인은 속도를 희생하지 않고 저장 공간이나 대역폭 사용량을 줄여야 하는 시나리오에 이상적입니다. Flutter의 pub 패키지 시스템을 통해 원활하게 통합되며, 동기 및 비동기 작업 모두를 지원합니다.
사용 사례
실시간 데이터 스트리밍
앱 번들 크기 줄이기
효율적인 파일 저장
네트워크 데이터 최적화
오프라인 데이터 캐싱
크로스 플랫폼 데이터 압축
주요 기능
고속 Zstandard 압축
네이티브 및 WebAssembly 플랫폼 지원
크로스 플랫폼 호환성
경량이고 빠름
pub를 통한 간편한 통합
비동기 및 동기 API
적합한 대상
빠른 압축이 필요한 앱
다중 플랫폼을 대상으로 하는 개발자
데이터 집약형 애플리케이션
성능 중심 환경
웹 및 모바일 하이브리드 앱
대역폭 또는 저장 공간을 최적화하는 애플리케이션
고려 사항
일부 환경에서는 플랫폼별 설정이 필요합니다
네이티브 바이너리로 인해 앱 크기가 증가할 수 있습니다
Zstandard 알고리즘에 제한됨
고급 기능을 위한 학습 곡선 가능성
웹에서 WebAssembly 지원에 의존
압축이 아닌 사용 사례에는 적합하지 않습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
Zstandard
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 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:
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: A pure Dart package providing CLI capabilities for macOS, Windows, and Linux. It enables command-line compression and decompression for data files and streams.
Native platform packages and the CLI share the zstd C source and FFI bindings via the zstandard_native package (zstandard_native/src/zstd/). zstandard_native is published to pub.dev as part of this repo’s release set, so a single copy is used whether you depend on the plugin from the repo or from pub.dev.
# Compress a file with a specified compression level
dart run zstandard_cli:compress --level 3 myfile.txt
# Decompress a file
dart run zstandard_cli:decompress myfile.txt.zstd
Dart Code Example (CLI)
import'package:zstandard_cli/zstandard_cli.dart';
voidmain() 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:
import'package:zstandard_cli/zstandard_cli.dart';
voidmain() async {
final originalData = Uint8List.fromList([...]);
final compressed = await originalData.compress(compressionLevel: 3);
final decompressed = await compressed.decompress();
}