The file size at which a ZIP64 record becomes necessary.
If a file larger than this threshold attempts to be written, compressed or uncompressed, and
FileOptions::large_file() was not true, then crate::ZipWriter will
raise an io::Error with io::ErrorKind::Other.
If the zip file itself is larger than this value, then a zip64 central directory record will be
written to the end of the file.
# fn main() -> Result<(), zip::result::ZipError> {
# #[cfg(target_pointer_width = "64")]
# {
use std::io::{self, Cursor, prelude::*};
use std::error::Error;
use zip::{ZipWriter, write::SimpleFileOptions};
let mut zip = ZipWriter::new(Cursor::new(Vec::new()));
let big_len: usize = (zip::ZIP64_BYTES_THR as usize) + 1;
let big_buf = vec![0u8; big_len];
{
let options = SimpleFileOptions::default()
.compression_method(zip::CompressionMethod::Stored);
zip.start_file("zero.dat", options)?;
let res = zip.write_all(&big_buf[..]).err().unwrap();
assert_eq!(res.kind(), io::ErrorKind::Other);
let description = format!("{}", &res);
assert_eq!(description, "Large file option has not been set");
zip.start_file("one.dat", options)?;
let zip = zip.finish_into_readable()?;
let names: Vec<_> = zip.file_names().collect();
assert_eq!(&names, &["one.dat"]);
}
let mut zip = ZipWriter::new(Cursor::new(Vec::new()));
let options = SimpleFileOptions::default()
.compression_method(zip::CompressionMethod::Stored)
.large_file(true);
zip.start_file("zero.dat", options)?;
assert!(zip.write_all(&big_buf[..]).is_ok());
# }
# Ok(())
# }