node-unrtf v5.0.1
Note An UnRTF v0.19.3 Windows binary is included with this module which, due to its age, has several issues, such as the inability to convert RTF documents generated from 2007 onwards, and a bug in the
noPictures
option that still generates pictures. It is recommended that whatever application is using thenode-unrtf
module is run in a Linux environment using the latest available UnRTF binaries, which do not have these bugs.
node-unrtf
Asynchronous node.js wrapper for the UnRTF RTF conversion program
Overview
UnRTF is a CLI program that allows for the manipulation and extraction of data from RTF documents such as converting RTF files to HTML or TXT.
The node-unrtf
module provides an asynchronous node.js wrapper around said CLI program for easier use.
Installation
Install using npm
:
npm i node-unrtf
Linux and macOS/Darwin support
For Linux and Mac users, you will need to download the unrtf
binary separately.
An example of downloading the binary on a Debian system:
sudo apt-get install unrtf
For macOS, the binary can be installed with Homebrew:
brew install unrtf
Example usage
Please refer to the JSDoc comments in the source code or the generated type definitions for information on the available options.
Async Await
Example of an async
await
call to convert an RTF file to HTML in an ESM environment:
import { UnRTF } from "node-unrtf";
const file = "test_document.rtf";
const unRtf = new UnRTF();
const options = {
outputHtml: true,
};
const res = await unRtf.convert(file, options);
console.log(res);
Promise chaining
Example of calling unRTF.convert with a promise chain in a CJS environment:
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);
return res;
})
.catch((err) => {
console.error(err);
throw err;
});
Contributing
Contributions are welcome, and any help is greatly appreciated!
See the contributing guide for details on how to get started. Please adhere to this project's Code of Conduct when contributing.
License
node-unrtf
is licensed under the MIT license.
10 days ago
2 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
8 months ago
5 months ago
7 months ago
8 months ago
8 months ago
8 months ago
9 months ago
10 months ago
11 months ago
11 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago