s3.atomic_write_text()

Write a text file so that a reader never sees it half-written.

Usage

Source

s3.atomic_write_text(
    path,
    text,
)

On an object store one put is atomic on its own, so the text is written directly. On the local filesystem the text goes to a sibling temporary file that is renamed over the target, and the temporary file is removed if the write fails.

Parameters

path: str, Path, or UPath

Destination.

text: str
Content to write.