indexed_file

Crates.ioindexed_file
lib.rsindexed_file
version0.1.2
sourcesrc
created_at2021-07-11 17:18:38.243436
updated_at2021-07-31 13:47:58.921872
descriptionA library to index and read large files by its lines efficiently
homepage
repositoryhttps://github.com/JojiiOfficial/IndexedFile
max_upload_size
id421502
size160,899
Jojii (JojiiOfficial)

documentation

README

IndexedFile

A library to read lines of a file directly without having to read more than the requested line.

Example

Non indexed files

use indexed_file::{Indexable, ReadByLine};

#[async_std::main]
async fn main() {
    // Open and index a file
    let mut file = indexed_file::File::open_raw("<some unindexed file>")
        .await
        .unwrap();

    // Get line count efficiently without reading the entire file
    let line_count = file.total_lines();

    // Read line 30 directly
    let line_30 = file.read_line(30).await.unwrap();
}

Indexed files

use indexed_file::{Indexable, ReadByLine};

#[async_std::main]
async fn main() {
    // Open an indexed file
    let mut file = indexed_file::File::open("<some indexed file>")
        .await
        .unwrap();

    // Read line 30 directly
    let line_30 = file.read_line(30).await.unwrap();
}

For more examples visit the examples directory.

Commit count: 38

cargo fmt