Crates.io | ole |
lib.rs | ole |
version | 0.1.15 |
source | src |
created_at | 2018-03-17 01:32:09.131918 |
updated_at | 2018-03-23 00:37:09.447204 |
description | Simple parser and reader for Microsoft Compound Document File. |
homepage | https://github.com/zadlg/ole |
repository | https://github.com/zadlg/ole.git |
max_upload_size | |
id | 56061 |
size | 595,391 |
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.
Add this to your Cargo.toml
:
[dependencies]
ole = "0.1.15"
and this to your crate root:
extern crate ole;
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[..]);
Release notes are available in RELEASES.md.
ole
seems to work for rust 1.9 and greater.