mirror of
https://github.com/zhigang1992/replace-in-file.git
synced 2026-04-30 13:42:33 +08:00
Document async/await usage
This commit is contained in:
12
README.md
12
README.md
@@ -29,6 +29,18 @@ const options = {
|
||||
};
|
||||
```
|
||||
|
||||
### Asynchronous replacement with `async`/`await`
|
||||
|
||||
```js
|
||||
try {
|
||||
const changes = await replace(options)
|
||||
console.log('Modified files:', changes.join(', '));
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Error occurred:', error);
|
||||
}
|
||||
```
|
||||
|
||||
### Asynchronous replacement with promises
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user