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 🙏

© 2026 – Pkg Stats / Ryan Hefner

e-ipfs-core-lib

v0.5.1

Published

E-IPFS core library

Readme

e-ipfs-core-lib

A library that collect utils and shared code for e-ipfs ecosystem.

Quickstart

npm i e-ipfs-core-lib

Api

Telemetry

Telemetry

Create a telemetry manager that provide a prometheus valid file format

Create metrics yaml configuration file:

---
component: bitswap-peer
metrics:
  count:
    bitswap-total-connections: BitSwap Total Connections
    s3-request: AWS S3 requests
    dynamo-request: AWS DynamoDB requests
version: 0.1.0
buildDate: "20220307.1423"
import path from 'path'
import { Telemetry, dirname } from 'e-ipfs-core-lib'

const configFile = path.join(dirname(import.meta.url), '../metrics.yml')
const telemetry = new Telemetry({ configFile })
telemetry.increaseCount('bitswap-total-connections', 2)

const result = await telemetry.export()
console.log(result)
telemetry.resetDurations()
telemetry.resetCounters()

Options

Telemetry instance methods

  • export: Export the metrics in prometheus format
      # HELP counter_label_count_total COUNTER (label-count)
      # TYPE counter_label_count_total counter
      counter_label_count_total{id="123"} 1 now
      counter_label_count_total{id="456"} 2 now
  • get(name): Get a single metric
  • getGaugeValue(name): Get the value of the gauge metric
  • getHistogramValue(name): Get the value (sum) of the histogram metric
  • resetAll(): Reset all metrics
  • resetCounters(): Reset count and labelCount metrics
  • resetDurations(): Reset durations metrics
  • resetGauges(): Reset gauges metrics
  • async export(): Export values in Prometheus format
  • increaseCount(category, amount = 1): Increase the count for a category
    • category: String - The given name of the category
  • increaseLabelCount(category, labels: Array, amount = 1): Increase the count for a key in a category
    • category: String - The given name of the category
    • labels: Array - The labels of the metric (eg. ['GET', 404])
    • amount: Number (Default 1) - The amount to add to the metric
  • increaseGauge(category, amount = 1): Increase the gauge for a category
    • category: String - The given name of the category
    • amount: Number (Default 1) - The amount to add to the metric
  • decreaseGauge(category, amount = 1): Increase the gauge for a category
    • category: String - The given name of the category
    • amount: Number (Default 1) - The amount to add to the metric
  • setGauge(category, value): Set the gauge for a category
    • category: String - The given name of the category
    • value: Number - The value to set the metric
  • trackDuration(category, promise): Track the duration of an async call
    • category: String - The given name of the category
    • promise: Promise - The function to be tracked

Configuration file format

Eg. of metrics.yml, to be passed to configFile

---
component: bitswap-peer
metrics:
  count:
    s3-request-count:
      description: AWS S3 requests
    dynamo-request-count:
      description: AWS DynamoDB requests
  labelCount:
    bitswap-request-per-connections-label-count:
      description: BitSwap Request Per Connnection
      labels:
        - method
        - status
  durations:
    bitswap-connections-duration-durations:
      description: BitSwap Connnection Duration
  gauge:
    bitswap-event-loop-utilization:
      description: BitSwap Event Loop Utilization
    bitswap-total-connections:
      description: BitSwap Total Connections

  process:
    elu: 
      name: bitswap-elu
      description: Bitswap Event Loop Utilization
      interval: 500

version: 0.1.0
buildDate: "20220307.1423"

Utils

dirname

version

cidToKey

AWS-Client

createAwsClient,

awsClientOptions,

Client

Logger

createLogger

Protocol