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

listener-rss-aggregator

v0.0.5

Published

--- ## Brief This is an aggregator of rss's listener (more information about it here : https://www.npmjs.com/package/listener-rss). ## Usage The basic usage is to use many listener-rss with a unique class. ```typescript import { ListenerRssAggregato

Downloads

24

Readme

Listener-rss-aggregator


Brief

This is an aggregator of rss's listener (more information about it here : https://www.npmjs.com/package/listener-rss).

Usage

The basic usage is to use many listener-rss with a unique class.

import { ListenerRssAggregator } from 'Listener-rss-aggregator';


const path = '/my/data/directorie/bd.sqlite'  
const configAggregator = await ListenerRssAggregator.instantiateAggregator(
    path
  );
myManager = new ListenerRssAggregator(configAggregator);

const listenerConfig: ListenerRss.Config =
	{
    	"address": "fake.rss.service.1",
    	"timeloop": 10
  	};

ml.registerListener(listenerConfig);

ml.on('update', (obj) => {
	doSomethingWithNewEntries(obj);
})

ml.startAll();

//...

ml.stopAll();

Documentation

Why SQLITE

This project use SQLITE to store the listener-rss configs and keep an correct historic of this. Sqlite was choice for her difficulty to access and read it. The database dont need to be modify by the user.

Constructor

The constructor need to have a file to store the sqlite data. If the file does not exist he will be create, but the path must be valid.

Function

registerListener(listenerConfig)

He's create an new listener-rss with the corresponding config data. (More information about the listenerConfig here : https://www.npmjs.com/package/listener-rss)

startAll()

Start all the listener who are actually register

stopAll()

Start all the listener who are actually register

editConfig(callback)

This method will call the callback with the actual config of the Manager and override the actual config with the returned object.
e.g.:

myManager.editConfig((actualConfig: ListenerRss.Config[]) : ListenerRss.Config[] => {
	const modifiedConfig = doSomethingToThisConfig(actualConfig);
	return modifiedConfig;
})

Events

Like listener-rss, listener-rss-aggregator implement EventEmitter.
He call the same events than listener-rss. One call is made for each listener who triggered an event.
The update event return all the rss file content in one json object. The newEntries event return an object with a file items who's contains the new items detected. And a field called addressListener who's a string with the address of the the rss service.