Skip to content

Write archive contents in chunks#589

Merged
adityaramani merged 4 commits intoapple:mainfrom
adityaramani:chunked-write
Mar 18, 2026
Merged

Write archive contents in chunks#589
adityaramani merged 4 commits intoapple:mainfrom
adityaramani:chunked-write

Conversation

@adityaramani
Copy link
Contributor

Fix a bug in ArchiveWriter where large files would only partly be written into an archive.
This is done so by writing the data in chunks.

Signed-off-by: Aditya Ramani <a_ramani@apple.com>

private static func copyDataReaderToFd(dataReader: ArchiveEntryReader, fileFd: Int32, memberPath: FilePath) throws {
var buffer = [UInt8](repeating: 0, count: ArchiveReader.blockSize)
var buffer = [UInt8](repeating: 0, count: ArchiveReader.chunkSize)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Does copyDataReaderToFd need to handle partial writes by looping until the full chunk is written?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does that already right?

@adityaramani adityaramani merged commit 420b915 into apple:main Mar 18, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants