|
2 | 2 | //! |
3 | 3 | //! ``` |
4 | 4 | //! # use std::error::Error; |
| 5 | +//! # use std::fs; |
| 6 | +//! # use std::io::{Cursor, Write as _}; |
5 | 7 | //! # use wacksy::WACZ; |
6 | 8 | //! # fn main() -> Result<(), Box<dyn Error>> { |
7 | 9 | //! let warc_file_path = std::path::Path::new("tests/example.warc.gz"); // set path to your ᴡᴀʀᴄ file |
8 | 10 | //! let wacz_object = WACZ::from_file(warc_file_path)?; // index the ᴡᴀʀᴄ and create a ᴡᴀᴄᴢ object |
9 | 11 | //! let zipped_wacz: Vec<u8> = wacz_object.as_zip_archive()?; // zip up the ᴡᴀᴄᴢ |
10 | | -//! std::fs::write("tests/output.wacz", zipped_wacz)?; // write out to file |
| 12 | +//! let mut wacz_file = fs::File::create("tests/example.wacz")?; |
| 13 | +//! # let mut wacz_file = Cursor::new(vec![0; 2048]); |
| 14 | +//! wacz_file.write_all(&zipped_wacz)?; // write out to file |
| 15 | +//! # fs::remove_file("tests/example.wacz")?; |
11 | 16 | //! # Ok(()) |
12 | 17 | //! # } |
13 | | -//! ``` |
| 18 | +//! |
14 | 19 | #![doc( |
15 | 20 | html_logo_url = "https://www.ox.ac.uk/sites/default/themes/custom/oxweb/images/oxweb-logo.gif", |
16 | 21 | html_favicon_url = "https://www.bodleian.ox.ac.uk/sites/default/files/styles/favicon-32x32/public/bodreader/site-favicon/bod-favicon.png" |
@@ -46,7 +51,7 @@ impl WACZ { |
46 | 51 | /// # Errors |
47 | 52 | /// |
48 | 53 | /// Returns a [`WaczError`], which can be caused by a problem in either the |
49 | | - /// [indexer](IndexingError) or the [datapackage](DataPackageError). As the |
| 54 | + /// indexer (structured errors to-do) or the [datapackage](DataPackageError). As the |
50 | 55 | /// datapackage depends on the index being complete, any problem with the |
51 | 56 | /// indexer will return early without continuing. |
52 | 57 | pub fn from_file(warc_file_path: &Path) -> Result<Self, WaczError> { |
|
0 commit comments