Skip to content

Progress never gets to 100% when reading an entry using a closure. #372

@vs1400

Description

@vs1400

Summary

I'm reading an entry using a closure and the progress object that I pass to extract(_:bufferSize:skipCRC32:progress:consumer:) never gets to 100%. More precisely, the progress.fractionCompleted never gets to 1.

Steps to Reproduce

let progress = Progress()
archive.extract(entry, bufferSize: 1024, progress: progress) {
	print("Completed: \(progress.fractionComplete)") // never gets to 1
}

Expected Results

Maybe I’m misunderstanding how this is supposed to work, but I’d expect progress to reflect the total number of read bytes when the closure is called, so that during the last call progress.fractionCompleted is equal to 1.

Actual Results

It looks like progress.completedUnitCount is updated after calling the closure, not before. When the last chunk is passed to the closure, progress.completedUnitCount is still less than progress.totalUnitCount. Also, during the first closure call, progress.completedUnitCount is 0.

Regression & Version

ZipFoundation 0.9.20, Xcode 26.1.1, macOS 26.1

Related Link

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions