Skip to content

A small Rust library to write to files atomically.

License

Notifications You must be signed in to change notification settings

Blobfolio/write_atomic

Repository files navigation

Write Atomic

docs.rs changelog
crates.io ci deps.rs
license contributions welcome

Write Atomic was originally a stripped-down remake of tempfile-fast, but with the 3.4.0 release of tempfile, it has largely been mooted.

(tempfile now supports Linux optimizations like O_TMPFILE natively.)

That said, one might still enjoy the ergonomic single-shot nature of Write Atomic's write_file and copy_file methods, as well as their permission/ownership-syncing behaviors, and so it lives on!

Examples

// One line is all it takes:
write_atomic::write_file("/path/to/my-file.txt", b"Some data!").unwrap();

Installation

Add write_atomic to your dependencies in Cargo.toml, like:

[dependencies]
write_atomic = "0.5.*"

License

See also: CREDITS.md

Copyright © 2024 Blobfolio, LLC <[email protected]>

This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004

Copyright (C) 2004 Sam Hocevar <[email protected]>

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

0. You just DO WHAT THE FUCK YOU WANT TO.