Giter Site home page Giter Site logo

feedr's Introduction

Feedr

Travis CI Build Status NPM version NPM downloads Dependency Status Dev Dependency Status
GitHub Sponsors donate button Patreon donate button Flattr donate button Liberapay donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button Wishlist browse button

Use feedr to fetch the data from a remote url, respect its caching, and parse its data. Despite its name, it's not just for feed data but also for all data that you can feed into it (including binary data).

Install

npm

  • Install: npm install --save feedr
  • Require: require('feedr')

This package is published with the following editions:

  • feedr aliases feedr/source/index.js
  • feedr/source/index.js is esnext source code with require for modules

Environments older than Node.js v8 may need Babel's Polyfill or something similar.

Usage

// Create a new feedr instance
const feedr = require('feedr').create({/* optional configuration */})

// Prepare our feeds that we want read
const feeds = {
	someAtomFeed: 'https://github.com/bevry/feedr/commits/for-testing.atom'
	someJsonFile: 'https://raw.githubusercontent.com/bevry/feedr/for-testing/package.json'
}

// Read a single feed
feedr.readFeed(feeds.someAtomFeed, {/* optional configuration */}, function (err, data, headers) {
	console.log(err, data, headers)
})

// Read all the feeds together
feedr.readFeeds(feeds, {/* optional configuration */}, function (err, result) {
	console.log(err, result.someAtomFeed, result.someJsonFile)
})

Configuration

Feed configuration defaults / global configuration properties are:

  • log defaults to null, log function to use
  • tmpPath defaults to system tmp path, the tempory path to cache our feedr results to
  • cache defaults to one day 1000*60*60*24, available values:
    • Number prefers to use the cache when it is within the range of the number in milliseconds
    • true prefers to use the cache when the response headers indicate that the cache is still valid
    • "preferred" will always use the cache if the cache exists
    • false will never use the cache
  • xml2jsOptions defaults to null, the options to send to xml2js
  • requestOptions defaults to null, the options to send to request

Feed configuration properties are:

  • url required, the url to fetch
  • hash defaults to hash of the url, the hashed url for caching
  • name defaults to hash, the name of the feed for use in debugging
  • path defaults to tmp feed path, the path to save the file to
  • parse defaults to true, whether or not we should attempt to parse the response data, supported values are xml, json, cson, yaml, string, raw/false. If true will try all the available parsers. Can also be a function with the signature ({response, data, feed, feedr}, next(err, data))
  • check defaults to true, whether or not we should check the response data for custom error messages. Can also be a function with the signature ({response, data, feed, feedr}, next(err))
  • xml2jsOptions defaults to global value, the options to send to xml2js
  • requestOptions defaults to global value, the options to send to request

History

Discover the release history by heading on over to the HISTORY.md file.

Contribute

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

No sponsors yet! Will you be the first?

GitHub Sponsors donate button Patreon donate button Flattr donate button Liberapay donate button Buy Me A Coffee donate button Open Collective donate button crypto donate button PayPal donate button Wishlist browse button

Contributors

These amazing people have contributed code to this project:

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

License

Unless stated otherwise all works are:

and licensed under:

feedr's People

Contributors

balupton avatar dependabot-preview[bot] avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

feedr's Issues

Will not call callback under special circumstances

When fetching http://raw.github.com/docpad/docpad-skeleton-nodechat/master/package.json with the invalid configuration of format: 'json' it seems the completion callback does not fire.

This should be looked into.

How we pass Max-limit

Hey could you please tell me how we pass the Max-limit in the url.

example : I want to fetch only 5 records from the URl

Thanks in Advance

Regards,
Ashutosh

Your .dependabot/config.yml contained invalid details

Dependabot encountered the following error when parsing your .dependabot/config.yml:

The property '#/update_configs/0/automerged_updates/0/match/update_type' value "security" did not match one of the following values: all, security:patch, semver:patch, semver:minor, in_range

Please update the config file to conform with Dependabot's specification using our docs and online validator.

Twitter example doesnt work

I think it is todo with the twitter API requiring it to use oauth now.

The the docpad example and the one here dont work anymore :S

Your .dependabot/config.yml contained invalid details

Dependabot encountered the following error when parsing your .dependabot/config.yml:

The property '#/update_configs/0/automerged_updates/0/match/update_type' value "security" did not match one of the following values: all, security:patch, semver:patch, semver:minor, in_range

Please update the config file to conform with Dependabot's specification using our docs and online validator.

Plugins key required?

It appears that the plugins key is required if you need to use e.g the xml plugin parser. This is not documented publicly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.