https://github.com/extensionengine/rtf-parser
Parse RTF documents
https://github.com/extensionengine/rtf-parser
Last synced: 3 months ago
JSON representation
Parse RTF documents
- Host: GitHub
- URL: https://github.com/extensionengine/rtf-parser
- Owner: ExtensionEngine
- License: mit
- Created: 2020-08-25T03:48:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-28T23:57:53.000Z (almost 5 years ago)
- Last Synced: 2025-01-26T09:31:33.846Z (5 months ago)
- Language: JavaScript
- Homepage:
- Size: 152 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @extensionengine/rtf-parser
[](https://app.circleci.com/pipelines/github/ExtensionEngine/rtf-parser?branch=master)
[](https://packagephobia.now.sh/result?p=@extensionengine/rtf-parser)
[](https://npm.im/@extensionengine/rtf-parser)
[](https://github.com/ExtensionEngine/rtf-parser/blob/master/LICENSE)
[](https://github.com/ExtensionEngine/eslint-config)> Parse RTF documents
## Installation
npm install @extensionengine/rtf-parser
## CLI
Convert RTF document to plain text:
npx -p @extensionengine/rtf-parser rtf2txt
## API
#### Table of Contents
- [parseRTF](#parsertf)
- [Parameters](#parameters)
- [Examples](#examples)
- [RTFDocument](#rtfdocument)### parseRTF
Parse RTF document
#### Parameters
- `buffer` **[Buffer](https://nodejs.org/api/buffer.html)** RTF document
#### Examples
```javascript
const parseRTF = require('@extensionengine/rtf-parser');
const path = require('path');
const { readFileSync } = require('fs');const rtf = readFileSync(path.join(__dirname, './reports/1110779471-20200721.rtf'));
parseRTF(rtf).then(rtfdoc => console.log({ rtfdoc }));
```Returns **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<[RTFDocument](#rtfdocument)>** RTF document object
### RTFDocument
- **See:
**Type: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)