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 🙏

© 2026 – Pkg Stats / Ryan Hefner

diffuse

v0.0.4

Published

RSS generator

Readme

#Diffuse

npm install diffuse

A fast and simple RSS generator for Node.

var RSS = require('diffuse');
var http = require('http');

var feed = RSS.createFeed({
  title: 'Amphibious Rodents',
  link: 'http://www.amphibiousrodentsclub.com',
  description: 'Where we share our thoughts about amphibiosu rodents'
});

feed.addItem({
  title: 'Let me introduce myself',
  description: 'My name is Bobby Stevenson and I command several fleets of amphibious rodents. Come with me on a journey to learn more about them. <p>My RSS feed can contain HTML in case I would like to <strong>emphasize</strong> my interest in rodents.',
  guid: '2013-1-20',
  pubDate: (new Date).toUTCString()
});

##Usage

Usage is fairly simple. The Diffuse API is mostly compatible with node-rss module.

var RSS = require('diffuse');

Creating a feed

Just call #createFeed with an object containing elements & their contents.

var feed = RSS.createFeed({
  title: 'my feed',

  link: 'www.example.com',

  // Not limited to text!
  description: {
    text: 'A description of my feed',
    attrs: {
      href: 'www.example.com'
    }
  }
});

Some elements are required according to RSS spec, and these are created for you automatically. Usually you would at least prefer to specify a title, link and a description, but diffuse will accept anything you throw at it. Unlike createFeed, createItem does not have any defaults.

Adding items

Call #addItem to add an item to your feed. This behaves similarly to createFeed, by building whatever elements you provide it.

var item = feed.addItem({
  title: 'The color white considered harmful',
  description: 'Here is the content of my RSS article. I hope you are ready for grammatical mistakes and poor word-flow.'
});

The title and description of the feed as well as items within it are wrapped in CDATA blocks, so your descriptions may contain HTML. Give her hell.

Rendering your feed

To render your feed, call #render. This returns the generated XML of your RSS feed, and accepts a callback.

var data = feed.render();

feed.render(function(err, data) {
  //Do stuff
});

Diffuse has an internal caching mechanism. Diffuse watches its document structure for modifications, and caches your generated XML. Re-rendering only needs to occur when the document has been modified. This happens either when you add a new item, or items have been modified using item#set. This gives it a significant performance advantage.

More item configuration

After you've created an item, you can still modify it using a simple API.

var item = feed.addItem({
  title: 'Butt'
});

item.set('title', 'My modified title. I  didn\'t mean to say butt. Silly me.'
item.title.set('text', 'Hello ');
item.title.set('text', item.title.get('text') + 'world');
item.title.set('attrs', { href: 'www.example.com' });

Building new Elements

Internally, Diffuse has a simple API for building its document structure. That is exposed to you if you need to build a more complicated structure.

var anchor = RSS.createElement('a', { href: 'http://www.google.com' });
anchor.appendText('My anchor.');

var mine = RSS.createElement('strong', ' Mine.');

anchor.appendChild(mine);

var content = anchor.toString();  // <a href='http://www.google.com'>My anchor. <strong>Mine.</strong></a>

##License

MIT