GithubHelp home page GithubHelp logo

hyperfeed's Introduction

Hyperfeed

NPM Version JavaScript Style Guide

Hyperfeed is a self-archiving P2P live feed. You can convert any RSS/ATOM/RDF feed to a P2P live update publishing network.

  • Self-archiving: Items and it's linked page will be archived within hyperfeed.
  • Decentralized: Feed contents can still be distributed between readers even if the original host is down.
  • Live: No need to poll the original feed. Updates will be pushed to you.
npm install hyperfeed

Synopsis

Publish your RSS feed through hyperfeed:

const request = require('request')
const hyperfeed = require('hyperfeed')
const hyperdrive = require('hyperdrive')
const swarm = require('hyperdiscovery')

const url = 'https://medium.com/feed/google-developers'

var archive = hyperdrive('./feed')
var feed = hyperfeed(archive)
feed.ready(() => {
  swarm(archive)
  console.log(feed.key.toString('hex'))
  feed.update(request(url), (err) => {
    console.log('feed imported')
  })
})

Now you can replicate the hyperfeed through a p2p network:

const Hyperfeed = require('hyperfeed')
const swarm = require('hyperdiscovery')
const hyperdrive = require('hyperdrive')

var archive = hyperdrive('./anotherFeed', '<KEY FROM ABOVE>')
var feed = hyperfeed(archive)
swarm(archive) // load the feed from the p2p network
feed.list((err, entries) => {
  console.log(entries) // all entries in the feed (include history entries)
})

API

var feed = hyperfeed(archive, [opts])

Create a new Hyperfeed instance. opts includes:

{
  scrapLink: true // set to false to stop archiving linked page for each feed item
}

feed.key

The public key identifying the feed.

feed.discoveryKey

A key derived from the public key that can be used to discovery other peers sharing this feed.

feed.meta

The metadata of the feed.

feed.ready(cb)

Wait for feed is fully ready and all properties has been populated.

feed.update(feedStream, cb(err, feed))

import a RSS feed into feed. Accept a stream.

feed.setMeta(metadataObject, cb(err))

Set feed's metadata.

feed.list(cb(err, entries))

List archived item in the feed.

feed.save(item, [scrappedData], cb(err))

Save a new feed item. Check https://github.com/jpmonette/feed for item detail.

If you already have scrapped data for the given item, you can pass it to scrappedData to avoid redundant requests.

feed.export(count, cb(err, rss))

Export a RSS-2.0 Feed containing latest count items.

License

The MIT License

hyperfeed's People

Contributors

millette avatar poga 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

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.