@javascriptcommon/react-native-xz
v1.1.2
Published
Native XZ/LZMA2 decompression for React Native (TurboModules)
Readme
react-native-xz
Native XZ/LZMA2 decompression for React Native. Provides fast, efficient decompression of .xz files using native libraries on both iOS and Android.
Features
- Native XZ/LZMA2 decompression
- Decompress files to disk or directly to string
- iOS: Uses SWCompression
- Android: Uses XZ for Java
- Supports React Native 0.72+
Installation
npm install @javascriptcommon/react-native-xz
# or
yarn add @javascriptcommon/react-native-xziOS
cd ios && pod installAndroid
No additional setup required.
Usage
import { decompressFile, decompressToString } from '@javascriptcommon/react-native-xz';
// Decompress a file to another file
const outputPath = await decompressFile('/path/to/file.xz', '/path/to/output');
// Decompress a file directly to a string
const content = await decompressToString('/path/to/file.xz');API
decompressFile(inputPath: string, outputPath: string): Promise<string>
Decompresses an XZ file to a destination path.
inputPath: Path to the.xzcompressed fileoutputPath: Path where decompressed file will be written- Returns: Promise resolving to the output path
decompressToString(inputPath: string): Promise<string>
Decompresses an XZ file and returns the contents as a UTF-8 string.
inputPath: Path to the.xzcompressed file- Returns: Promise resolving to the decompressed string content
Requirements
- React Native >= 0.72.0
- iOS >= 13.0
- Android minSdk >= 21
License
MIT
