write-file-atomic
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "write-file-atomic", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Write files in an atomic fashion w/configurable ownership", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -5,6 +5,3 @@ write-file-atomic | ||
This is an extension for node's `fs.writeFile` that makes its operation | ||
atomic allows you to include uid/gid for the final file as well. It does | ||
this by initially writing to a temporary file (your filename, followed by | ||
".writeFile.atomic"), chowning it to the uid and gid you specified (if you | ||
specified any) and finally renames it to your filename. | ||
atomic and allows you set ownership (uid/gid of the file). | ||
@@ -26,2 +23,8 @@ ### var writeFileAtomic = require('write-file-atomic')<br>writeFileAtomic(filename, data, [options], callback) | ||
The file is initially named `filename + "." + md5hex(__filename, process.pid, ++invocations)`. | ||
If writeFile completes successfully then, if passed the **chown** option it will change | ||
the ownership of the file. Finally it renames the file back to the filename you specified. If | ||
it encounters errors at any of these steps it will attempt to unlink the temporary file and then | ||
pass the error back to the caller. | ||
If provided, the **chown** option requires both **uid** and **gid** properties or else | ||
@@ -28,0 +31,0 @@ you'll get an error. |
8834
45