ole/lib.rs
1// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2// Version 2, December 2004
3//
4// Copyright (C) 2018 Thomas Bailleux <thomas@bailleux.me>
5//
6// Everyone is permitted to copy and distribute verbatim or modified
7// copies of this license document, and changing it is allowed as long
8// as the name is changed.
9//
10// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11// TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12//
13// 0. You just DO WHAT THE FUCK YOU WANT TO.
14//
15// Author: zadig <thomas chr(0x40) bailleux.me>
16
17//! A simple parser and reader for Microsoft Compound Document File.
18//!
19//! This includes a basic parser, which validates the format of a given file
20//! or a given stream.
21//! It includes a reader too, for iterating over entries and for extracting
22//! files inside the OLE storage.
23//!
24//! ## Example
25//!
26//! ```
27//!
28//! use ole::Reader;
29//! use std::io::{Read, Write};
30//!
31//! let mut file = std::fs::File::open("assets/Thumbs.db").unwrap();
32//! let mut parser = Reader::new(file).unwrap();
33//!
34//! // Iterate through the entries
35//! for entry in parser.iterate() {
36//! println!("{}", entry);
37//! }
38//!
39//! // We're going to extract a file from the OLE storage
40//! let entry = parser.iterate().next().unwrap();
41//! let mut slice = parser.get_entry_slice(entry).unwrap();
42//! let mut buffer = std::vec::Vec::<u8>::with_capacity(slice.len());
43//! slice.read_to_end(&mut buffer);
44//!
45//! // Saves the extracted file
46//! let mut extracted_file = std::fs::File::create("./file.bin").unwrap();
47//! extracted_file.write_all(&buffer[..]);
48//! ```
49//!
50//! ## Compatibility
51//!
52//! The `ole` crate is tested for rust 1.9 or greater.
53
54
55mod ole;
56pub use ole::Reader;
57pub(crate) mod iterator;
58pub use iterator::OLEIterator;
59mod error;
60pub use error::Error;
61pub(crate) mod header;
62pub(crate) mod util;
63pub(crate) mod sat;
64pub(crate) mod constants;
65pub(crate) mod entry;
66pub use entry::Entry;
67pub use entry::EntrySlice;
68pub use entry::EntryType;
69pub(crate) mod sector;