Skip to content

Commit

Permalink
docs(readme): update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Frazer Smith committed Dec 29, 2020
1 parent 4ec6633 commit 22d5943
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ const unRtf = new UnRTF("./usr/bin");
const { UnRTF } = require("node-unrtf");
```

[API Documentation can be found here](https://github.com/Fdawgs/node-unrtf/blob/master/API.md)
[**API Documentation can be found here**](https://github.com/Fdawgs/node-unrtf/blob/master/API.md)

## Example
## Examples

Example of an async await call to convert an RTF file to HTML, and then output the result to console:
### Async Await

Example of an `async` `await` call to convert an RTF file to HTML, and then output the result to console:

```js
const { UnRTF } = require("node-unrtf");
Expand All @@ -74,6 +76,24 @@ const res = await unRtf.convert(file, options);
console.log(res);
```

### Promise Chaining

Example of calling unRTF.convert with a promise chain:

```js
const { UnRTF } = require("node-unrtf");

const file = "test_document.rtf";
const unRtf = new UnRTF("./usr/bin");
const options = {
outputHtml: true,
};

unRTF.convert(file, options).then((res) => {
console.log(res);
});
```

## Contributing

Please see [CONTRIBUTING.md](https://github.com/Fdawgs/node-unrtf/blob/master/CONTRIBUTING.md) for more details regarding contributing to this project.
Expand Down

0 comments on commit 22d5943

Please sign in to comment.