Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 22c6990

Browse files
authoredJan 18, 2022
docs(readme): clean up API/usage syntax (#90)
fixes readme syntax
1 parent d4d0f3c commit 22c6990

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed
 

‎README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@ write-file-atomic
44
This is an extension for node's `fs.writeFile` that makes its operation
55
atomic 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

2434
The file is initially named `filename + "." + murmurhex(__filename, process.pid, ++invocations)`.
2535
Note 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

7284
The 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

Comments
 (0)
Please sign in to comment.