New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

feedify

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feedify

A package for parsing RSS and Atom feeds

latest
Source
npmnpm
Version
0.4.0
Version published
Maintainers
1
Created
Source

Feedify

All Contributors Build Bundlephobia

NPM

A package for parsing RSS 2.0, Atom 1.0.

Installation

npm add feedify

Usage

Simple

import { parse } from 'feedify';

fetch('https://overreacted.io/rss.xml')
	.then(resp => {
		return resp.text();
	})
	.then(text => {
		return parse(text);
	})
	.then(data => {
		console.log('Feed: ', data.feed);
		console.log('Items: ', data.items);
	});

Stream-like

If you want more control you can use parsers directly. E.g.:

import { RSSParser } from 'feedify';

const parser = new RSSParser();

parser.write('<rss> ....');
parser.write('... </rss>');
// ...

// You MUST close the stream or an infinite loop might happen
parser.close();

for (let item of parser.items()) {
	console.log(item);
}

console.log(parser.feed());

Error handling

import { parse } from 'feedify';

const text = 'borken feed';

// using .catch
parse(text)
	.then(output => console.log(output))
	.catch(err => {
		console.log('Oops, ', err);
	});

// OR, using try catch

try {
	const output = await parse(text);
	console.log(output);
} catch (err) {
	console.log('Oops, ', err);
}

Contributors

Thanks goes to these wonderful people (emoji key):

Ahmed T. Ali
Ahmed T. Ali

💻 📖 🚧 ⚠️

This project follows the all-contributors specification. Contributions of any kind welcome!

License

MIT © Ahmed T. Ali

Keywords

atom

FAQs

Package last updated on 08 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts