marcobellaccini/pyAesCrypt

[enhancement] Create .tmp before clear output file

Dead4W opened this issue · 4 comments

I think we can create .tmp file and rename/move it after success encryptFile/decryptFile process

See https://github.com/Dead4W/pyAesCrypt/tree/patch-1

Hi,
I don't think it's a good idea to change this behavior now: a lot of programs depends on the module and it's currently working without creating temp files.
I'm willing to change the way it interacts with the external environment only if it's really important to do it.

It's update is not about encryptStream/decryptStream.

Before update encryptFile:
start encryptFile -> create output.file -> write to output.file -> use output.file in program

After update encryptFile:
start encryptFile -> create output.file.tmp -> write to output.file.tmp -> rename output.file.tmp to output.file -> use output.file in program

Could this interfere with the programs? Output file is the same I think there shouldn't be any problems

This is true in most cases.
Nevertheless, sometimes people setup automated workflows featuring watchfolders.
In those cases, having temp files may cause problems.
Your idea is good, but I don't think it's savy to implement it now (maybe can be included in a major release, though).

I got it, thanks for the explanation!