Skip to content

Writeable file object that atomically updates a file.

License

Notifications You must be signed in to change notification settings

avoidscorn/atomicfile

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AtomicFile

https://travis-ci.org/sashka/atomicfile.png?branch=master

Writeable file object that atomically updates a file.

All writes will go to a temporary file. Call close() explicitly when you are done writing, and AtomicFile will rename the temporary copy to the original name, making the changes visible. If the object is destroyed without being closed, all your writes are discarded.

AtomicFile is friendly to with statement.

from atomicfile import AtomicFile

with AtomicFile("panic.txt", "w") as f:
    f.write(json.dumps(big_data_array_100MB, sort_keys=True, indent=4))

Install

To install AtomicFile, simply:

pip install atomicfile

You can buy me a cup of coffee or a glass of wine. Bitcoin could be sent to 1Boahzk5jMTebqiKVESzbnVWTvBTGnAvYf

About

Writeable file object that atomically updates a file.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published