npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

unrtf

v0.2.1

Published

Converts RTF documents to HTML

Downloads

438

Readme

unrtf

Converts RTF documents to HTML. It features two engines that performs a bit differently, so you might try both on your RTF data.

Install

By default the only prerequisite is to install Python. Then install this module:

npm install unrtf

Example

var unrtf = require('unrtf');

unrtf(
  '{\\rtf1\\ansi\\ansicpg1252\\cocoartf1265\\cocoasubrtf210\n{\\fonttbl\\f0\\fswiss\\fcharset0 Helvetica;}\n{\\colortbl;\\red255\\green255\\blue255;}\n\\paperw11900\\paperh16840\\margl1440\\margr1440\\vieww10800\\viewh8400\\viewkind0\n\\pard\\tx566\\tx1133\\tx1700\\tx2267\\tx2834\\tx3401\\tx3968\\tx4535\\tx5102\\tx5669\\tx6236\\tx6803\\pardirnatural\n\n\\f0\\fs24 \\cf0 Hello, World!\\\n\\\nThis is RTF. :-)}',
  function(error, result) {
    console.log(result.html);
  }
);

API

unrtf(doc, [options], callback)

doc

Type: string (required)

The input RTF document you want to convert.

options

Type: object (optional)

Two options are supported:

  1. engine, choose the RTF converter engine, either "pyth" (default) or "unrtf"
  2. unclean, if set to true it will not try to clean up the resulting HTML code, only applies to unrtf engine (default false)
  3. timeout, set the timeout of calling the unrtf command in milliseconds (default 2000)

callback

Type: function (required)

Invoked with the result or error, if any.

Engines

You can choose between two engines:

  1. "pyth" (default), depends on Python being installed on your system
  2. "unrtf", depends on a command line utility

If you want to use the unrtf engine, you need to first install the utility:

You can set the default engine:

var unrtf = require('unrtf');

unrtf.defaultEngine = 'unrtf';

License

The code for node-unrtf is licensed under the MIT license. See license.txt file for more info.