pub fn new_append(mut readwriter: A) -> ZipResult<ZipWriter<A>> {
        let (footer, cde_start_pos) = spec::CentralDirectoryEnd::find_and_parse(&mut readwriter)?;

        if footer.disk_number != footer.disk_with_central_directory {
            return Err(ZipError::UnsupportedArchive(
                "Support for multi-disk files is not implemented",
            ));
        }

        let (archive_offset, directory_start, number_of_files) =
            ZipArchive::get_directory_counts(&mut readwriter, &footer, cde_start_pos)?;

        if let Err(_) = readwriter.seek(io::SeekFrom::Start(directory_start)) {
            return Err(ZipError::InvalidArchive(
                "Could not seek to start of central directory",
            ));
        }

        let files = (0..number_of_files)
            .map(|_| central_header_to_zip_file(&mut readwriter, archive_offset))
            .collect::<Result<Vec<_>, _>>()?;

        let _ = readwriter.seek(io::SeekFrom::Start(directory_start)); // seek directory_start to overwrite it

        Ok(ZipWriter {
            inner: GenericZipWriter::Storer(readwriter),
            files,
            stats: Default::default(),
            writing_to_file: false,
            writing_to_extra_field: false,
            writing_to_central_extra_field_only: false,
            comment: footer.zip_file_comment,
            writing_raw: true, // avoid recomputing the last file's header
        })
    }
/// Initializes the archive from an existing ZIP archive, making it ready for append.
Initializes the archive from an existing ZIP archive, making it ready for append.
Initializes the archive from an existing ZIP archive making it ready for append .
pub fn new_append(mut readwriter: A) -> ZipResult<ZipWriter<A>> {
        let (footer, cde_start_pos) = spec::CentralDirectoryEnd::find_and_parse(&mut readwriter)?;
        if footer.disk_number != footer.disk_with_central_directory {
            return Err(ZipError::UnsupportedArchive(
                "Support for multi-disk files is not implemented",
            ));
        }
        let (archive_offset, directory_start, number_of_files) =
            ZipArchive::get_directory_counts(&mut readwriter, &footer, cde_start_pos)?;
        if let Err(_) = readwriter.seek(io::SeekFrom::Start(directory_start)) {
            return Err(ZipError::InvalidArchive(
                "Could not seek to start of central directory",
            ));
        }
        let files = (0..number_of_files)
            .map(|_| central_header_to_zip_file(&mut readwriter, archive_offset))
            .collect::<Result<Vec<_>, _>>()?;
        let _ = readwriter.seek(io::SeekFrom::Start(directory_start)); // seek directory_start to overwrite it
        Ok(ZipWriter {
            inner: GenericZipWriter::Storer(readwriter),
            files,
            stats: Default::default(),
            writing_to_file: false,
            writing_to_extra_field: false,
            writing_to_central_extra_field_only: false,
            comment: footer.zip_file_comment,
            writing_raw: true, // avoid recomputing the last file's header
        })
    }
pub fn new_append ( mut readwriter : A ) -> ZipResult < ZipWriter < A > > { let ( footer , cde_start_pos ) = spec :: CentralDirectoryEnd :: find_and_parse ( & mut readwriter ) ? ; if footer . disk_number != footer . disk_with_central_directory { return Err ( ZipError :: UnsupportedArchive ( " " , ) ) ; } let ( archive_offset , directory_start , number_of_files ) = ZipArchive :: get_directory_counts ( & mut readwriter , & footer , cde_start_pos ) ? ; if let Err ( _ ) = readwriter . seek ( io :: SeekFrom :: Start ( directory_start ) ) { return Err ( ZipError :: InvalidArchive ( " " , ) ) ; } let files = ( 0 .. number_of_files ) . map ( | _ | central_header_to_zip_file ( & mut readwriter , archive_offset ) ) . collect :: < Result < Vec < _ > , _ > > ( ) ? ; let _ = readwriter . seek ( io :: SeekFrom :: Start ( directory_start ) ) ; // seek directory_start to overwrite it Ok ( ZipWriter { inner : GenericZipWriter :: Storer ( readwriter ) , files , stats : Default :: default ( ) , writing_to_file : false , writing_to_extra_field : false , writing_to_central_extra_field_only : false , comment : footer . zip_file_comment , writing_raw : true , // avoid recomputing the last file's header } ) }
Initializes the archive from an existing ZIP archive, making it ready for append.
Initializes the archive from an existing ZIP archive making it ready for append .
readwriter
A
readwriter
A