msi/
lib.rs

1//! A library for reading/writing [Windows
2//! Installer](https://en.wikipedia.org/wiki/Windows_Installer) (MSI) files.
3//!
4//! A Windows Installer file, or *MSI file*, represents a Windows software
5//! package and a declarative description of how it should be installed.
6//! An MSI file consists of a relational database stored within a [Compound
7//! File Binary](https://en.wikipedia.org/wiki/Compound_File_Binary_Format)
8//! file.
9
10#![warn(missing_docs)]
11
12extern crate byteorder;
13extern crate cfb;
14extern crate encoding_rs;
15extern crate uuid;
16
17mod internal;
18
19pub use crate::internal::category::Category;
20pub use crate::internal::codepage::CodePage;
21pub use crate::internal::column::{Column, ColumnBuilder, ColumnType};
22pub use crate::internal::expr::Expr;
23pub use crate::internal::language::Language;
24pub use crate::internal::package::{Package, PackageType, Tables};
25pub use crate::internal::query::{Delete, Insert, Select, Update};
26pub use crate::internal::stream::{StreamReader, StreamWriter, Streams};
27pub use crate::internal::summary::SummaryInfo;
28pub use crate::internal::table::{Row, Rows, Table};
29pub use crate::internal::value::Value;
30use std::fs;
31use std::io;
32use std::path::Path;
33
34// ========================================================================= //
35
36/// Opens an existing MSI file at the given path in read-only mode.
37pub fn open<P: AsRef<Path>>(path: P) -> io::Result<Package<fs::File>> {
38    Package::open(fs::File::open(path)?)
39}
40
41/// Opens an existing MSI file at the given path in read-write mode.
42pub fn open_rw<P: AsRef<Path>>(path: P) -> io::Result<Package<fs::File>> {
43    Package::open(fs::OpenOptions::new().read(true).write(true).open(path)?)
44}
45
46// ========================================================================= //