#document #parser #format-file #read-write #compound #file #io-read

ole

Simple parser and reader for Microsoft Compound Document File

16 releases

Uses old Rust 2015

0.1.15 Mar 23, 2018
0.1.14 Mar 21, 2018

#2942 in Parser implementations

Download history 4/week @ 2024-11-13 17/week @ 2024-11-20 26/week @ 2024-11-27 30/week @ 2024-12-04 35/week @ 2024-12-11 11/week @ 2024-12-18 18/week @ 2024-12-25 5/week @ 2025-01-01 12/week @ 2025-01-08 22/week @ 2025-01-15 20/week @ 2025-01-22 18/week @ 2025-01-29 22/week @ 2025-02-05 33/week @ 2025-02-12 16/week @ 2025-02-19 33/week @ 2025-02-26

109 downloads per month
Used in 3 crates (2 directly)

WTFPL license

595KB
838 lines

OLE

Crates.io Crates.io license

A simple parser and reader for Microsoft Compound Document File.

This includes a basic parser, which validates the format of a given file or a given stream. It includes a reader too, for iterating over entries and for extracting files inside the OLE storage.

Usage

Add this to your Cargo.toml:

[dependencies]
ole = "0.1.15"

and this to your crate root:

extern crate ole;

Example

use ole::Reader;
use std::io::{Read, Write};
let mut file = std::fs::File::open("assets/Thumbs.db").unwrap();
let mut parser = Reader::new(file).unwrap();
// Iterate through the entries
for entry in parser.iterate() {
    println!("{}", entry);
}
// We're going to extract a file from the OLE storage
let entry = parser.iterate().next().unwrap();
let mut slice = parser.get_entry_slice(entry).unwrap();
let mut buffer = std::vec::Vec::<u8>::with_capacity(slice.len());
slice.read_to_end(&mut buffer);
// Saves the extracted file
let mut extracted_file = std::fs::File::create("./file.bin").unwrap();
extracted_file.write_all(&buffer[..]);

Releases

Release notes are available in RELEASES.md.

Compatibility

ole seems to work for rust 1.9 and greater.

License

http://www.wtfpl.net/about/

No runtime deps