Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Avoid the use of a temporary files whenenver possible #50

@caesay

Description

@caesay

In the compress command, it looks like the chunks are all written to a temporary file, then the bita header is written to the output file, and finally the chunks are copied to the output file.

This introduces significant points for failure (esp on Windows) and we should avoid temp files whenever possible. Ideally, we will open the output file once, and then not close it until we are done. So we open the file, write the header first, and then give the same output file handle to the chunker.

If you are in overwrite/force mode, this does introduce a slightly increased possibility that we would have paved over a perfectly good file and left junk in it's wake, but I think that is going to be a less common scenario than the compression has failed because Windows Defender or some other junk has decided to lock the output file between writing the header and copying the chunks etc.

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