@@ -4,8 +4,14 @@ write-file-atomic
44This is an extension for node's ` fs.writeFile ` that makes its operation
55atomic and allows you set ownership (uid/gid of the file).
66
7- ### var writeFileAtomic = require('write-file-atomic')< br >writeFileAtomic( filename, data, [ options] , [ callback] )
7+ ### ` writeFileAtomic( filename, data, [options], [callback]) `
88
9+ #### Description:
10+
11+ Atomically and asynchronously writes data to a file, replacing the file if it already
12+ exists. data can be a string or a buffer.
13+
14+ #### Options:
915* filename ** String**
1016* data ** String** | ** Buffer**
1117* options ** Object** | ** String**
@@ -18,8 +24,12 @@ atomic and allows you set ownership (uid/gid of the file).
1824 * tmpfileCreated ** Function** called when the tmpfile is created
1925* callback ** Function**
2026
21- Atomically and asynchronously writes data to a file, replacing the file if it already
22- exists. data can be a string or a buffer.
27+ #### Usage:
28+
29+ ``` js
30+ var writeFileAtomic = require (' write-file-atomic' )
31+ writeFileAtomic (filename, data, [options], [callback])
32+ ```
2333
2434The file is initially named ` filename + "." + murmurhex(__filename, process.pid, ++invocations) ` .
2535Note that ` require('worker_threads').threadId ` is used in addition to ` process.pid ` if running inside of a worker thread.
@@ -67,6 +77,15 @@ This function also supports async/await:
6777})();
6878```
6979
70- ### var writeFileAtomicSync = require('write-file-atomic').sync<br >writeFileAtomicSync(filename, data, [ options] )
80+ ### ` writeFileAtomicSync(filename, data, [options]) `
81+
82+ #### Description:
7183
7284The synchronous version of ** writeFileAtomic** .
85+
86+ #### Usage:
87+ ``` js
88+ var writeFileAtomicSync = require (' write-file-atomic' ).sync
89+ writeFileAtomicSync (filename, data, [options])
90+ ```
91+
0 commit comments