sleep-parser

crates.io version build status downloads docs.rs docs

Parse Dat protocol SLEEP files.

Usage

```rust extern crate sleepparser as sleepparser;

use sleep_parser::{FileType, HashType, Header}; use std::fs::File; use std::io::{BufRead, BufReader};

let file = File::open("tests/fixtures/content.bitfield").unwrap(); let mut reader = BufReader::withcapacity(32, file); let buffer = reader.fillbuf().unwrap(); let header = Header::fromvec(&buffer).unwrap(); assert!(header.isbitfield()); ```

Format

txt,ignore <32 byte header> <4 byte magic string: 0x05025702> <1 byte version number: 0> <2 byte entry size: 40> <1 byte algorithm name length prefix: 7> <7 byte algorithm name: BLAKE2b> <17 zeroes> <40 byte entries> <32 byte BLAKE2b hash> <8 byte Uint64BE children leaf byte length>

Installation

sh $ cargo add sleep-parser

License

Primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, and LICENSE-MIT for more details.