Code Monkey home page Code Monkey logo

ipfs-stats's Introduction

⚠️ THIS PACKAGE IS NO LONGER MAINTAINED!

ipfs-stats

npm Travis

This lets you poll peer and node stats from IPFS very easily.

Install

In Node.js through npm

$ npm install --save ipfs-stats

Browser: Browserify, Webpack, other bundlers

The code published to npm that gets loaded on require is in fact an ES5 transpiled version with the right shims added. This means that you can require it and use with your favorite bundler without having to adjust asset management process.

const StatsPoller = require('ipfs-stats')

In the Browser through <script> tag

Loading this module through a script tag will make the IpfsStats obj available in the global namespace.

<script src="https://unpkg.com/ipfs-stats/dist/index.min.js"></script>
<!-- OR -->
<script src="https://unpkg.com/ipfs-stats/dist/index.js"></script>

API

Class StatsPoller

new StatsPoller(ipfs, [frequency])

  • ipfs Object. IPFS API Object.
  • frequency Integer (optional). The frequency, in milliseconds, to push new stats. Defaults to 1000.

Properties

  • poller.stats retrieves the current stats. It should contain the fields bw, id, peers and repo.

Methods

  • poller.start([opts]) tells the poller to start polling the opts.
  • poller.stop([opts]) tells the poller to stop polling the opts.

opts is an Array of strings. Default is ['bw', 'id', 'peers', 'repo']. Beware that the id poller only runs once because the ID stats are the same throughout the lifespan of the daemon.

Events

  • change

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.