I'd add that
* it does so in an atomic manner. That is, it writes to a temporary file first and moves that in place later on so other users see either the old or new state.
* If the first argument is a path, the directory pointed to will be created if necessary.
* A desired file mode can be passed as an optional third argument.