zstandard_native 패키지는 Flutter 외부 함수 인터페이스(FFI) 바인딩을 통해 zstd 압축 알고리즘의 네이티브 C 구현을 제공합니다. 이는 Android, iOS, Linux, macOS, Windows 등 여러 플랫폼에서 Flutter 애플리케이션에 고성능 압축 및 압축 해제를 가능하게 합니다. 원본 zstd C 라이브러리를 활용하여 낮은 메모리 오버헤드와 빠른 처리 속도로 효율적인 데이터 압축을 제공합니다. 성능과 효율성이 중요한 대용량 파일 또는 스트리밍 데이터 처리에 이상적입니다. 간단한 pub 종속성으로 Flutter 프로젝트에 쉽게 통합할 수 있습니다.
사용 사례
모바일 앱에서의 고속 데이터 압축
효율적인 파일 저장 최적화
저대역폭 실시간 데이터 스트리밍
데스크톱 앱에서의 대규모 데이터 처리
백업 및 아카이브 솔루션
주요 기능
네이티브 zstd C 라이브러리 통합
크로스 플랫폼 지원 (Android, iOS, Linux, macOS, Windows)
고성능 압축/압축 해제
낮은 메모리 사용량
FFI 기반의 Dart 바인딩을 통한 원활한 통합
적합한 대상
성능 중심 애플리케이션
데이터 집약적인 모바일 및 데스크톱 앱
효율적인 파일 압축이 필요한 응용 프로그램
zstd 기능에 직접 액세스가 필요한 개발자
속도와 효율성을 우선시하는 프로젝트
고려 사항
각 플랫폼에 대해 네이티브 컴파일이 필요합니다
네이티브 바이너리로 인해 앱 크기가 증가할 수 있습니다
zstd 전용 압축 요구 사항에 국한됨
네이티브 코드 디버깅 시 발생할 수 있는 복잡성
외부 C 라이브러리 의존성 유지
원본 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();
}