Skip to content

Write archive contents in chunks#589

Open
adityaramani wants to merge 3 commits intoapple:mainfrom
adityaramani:chunked-write
Open

Write archive contents in chunks#589
adityaramani wants to merge 3 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>
try self.writeHeader(entry: entry)
let chunkSize = 4 * 1024 * 1024
while true {
let chunk = fileHandle.readData(ofLength: chunkSize)
Copy link
Member

Choose a reason for hiding this comment

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

Can we just have a preallocated scratch buffer in our writer of size chunkSize that we fill, and use read(2) directly. I have a vendetta against fileHandle readData LOL

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

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.

2 participants