Skip to main content

rar_stream/
lib.rs

1//! RAR streaming library with NAPI bindings.
2//!
3//! Rust port of rar-stream for streaming files from RAR archives.
4//! Optimized for video streaming with fast seeking via binary search.
5//!
6//! Supports RAR15 (RAR 1.5-4.x) and RAR50 (RAR 5.0+) formats.
7//!
8//! ## Features
9//! - Core library has **zero dependencies**
10//! - `async` - Async file reading with tokio
11//! - `napi` - Node.js bindings
12//! - `wasm` - Browser WASM bindings
13
14#![forbid(unsafe_code)]
15
16mod crc32;
17pub mod decompress;
18pub mod error;
19mod file_media;
20pub mod formats;
21pub mod parsing;
22
23// Async modules (require 'async' feature)
24#[cfg(feature = "async")]
25mod inner_file;
26#[cfg(feature = "async")]
27mod rar_file_chunk;
28#[cfg(feature = "async")]
29mod rar_files_package;
30
31#[cfg(feature = "napi")]
32mod napi_bindings;
33
34#[cfg(feature = "wasm")]
35mod wasm_bindings;
36
37pub use error::RarError;
38pub use file_media::{LocalFileMedia, ReadInterval};
39
40#[cfg(feature = "async")]
41pub use file_media::FileMedia;
42#[cfg(feature = "async")]
43pub use inner_file::{ChunkMapEntry, InnerFile, InnerFileStream, StreamChunkInfo};
44#[cfg(feature = "async")]
45pub use rar_file_chunk::RarFileChunk;
46#[cfg(feature = "async")]
47pub use rar_files_package::{ParseOptions, RarFilesPackage};
48
49// Re-export decompression types
50pub use decompress::{CompressionMethod, DecompressError, Rar29Decoder};
51
52// Re-export NAPI bindings when feature is enabled
53#[cfg(feature = "napi")]
54pub use napi_bindings::*;
55
56// Re-export WASM bindings when feature is enabled
57#[cfg(feature = "wasm")]
58pub use wasm_bindings::*;