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

@videomark/sulfur.js

v1.0.0

Published

Sulfur library

Readme

統計情報収集ライブラリ (sulfur library API)

<script> を使用してロードを行う

<script src="./sulfur.js "></script>

Constructor

ライブラリオブジェクトの生成

Constructor(options)

const sulfur = new Sulfur(options);

| Name | Type | Required | Default | Description | | --------------- | ------ | :------: | :-----: | ------------------------ | | url | string | x | - | 送信先エンドポイント | | collectInterval | number | x | 1000 | 統計情報収集インターバル | | sendInterval | number | x | 5000 | 統計情報送信インターバル |

open

統計情報収集開始

open(peer, connection, options)

| Name | Type | Required | Default | Description | | ---------- | ------------------------------------------------------------------------------------------- | :------: | :-----: | ------------------------------------------ | | peer | Peer | o | - | SkyWay API の Peer オブジェクト | | connection | MediaConnection | o | - | SkyWay API の MediaConnection オブジェクト | | options | Object | x | - | Options オブジェクト |

Options

| Name | Type | Required | Default | Description | | ------------ | ---------------- | :------: | :-----: | ---------------------- | | video | HTMLVideoElement | x | - | 通話用の Video Element | | additionalId | string | x | "" | additional ID |

const peer = new Peer({
  key: API_KEY,
});

const sulfur = new Sulfur();

...
// 発信時
const connection = peer.call(remoteId, localStream);
sulfur.open(peer, connection, {
  video: document.getElementById("remote-pid"), // 対向のpeerID
  additionalId: "additionalId"
});

...
// 着信時
peer.on('call', mediaConnection => {
  mediaConnection.answer(localStream);
  sulfur.open(peer, mediaConnection, {
    video: document.getElementById("remote-pid"), // 対向のpeerID
    additionalId: "additionalId"
  });
});

close

統計情報収集終了

close()

connection.close(true);
sulfur.close();

Events

Event:'error'

エラーが発生した場合のイベント

| Name | Type | Description | | ----- | ----- | ------------------ | | error | Error | エラーオブジェクト |

| Type | Description | | ----------- | ---------------------------------- | | open | 統計情報収集開始に失敗 | | validate | 送信データ検証でエラーが見つかった | | closed | 通話相手との接続が切れた | | transaction | 統計情報収集サーバとの通信に失敗 |

sulfur.on("error", (e) => {
  // ...
});

Event:'opened'

統計情報収集を開始した場合のイベント

| Name | Type | Description | | ------- | ------ | ------------------------ | | url | string | 送信先エンドポイント | | collect | number | 統計情報収集インターバル | | send | number | 統計情報送信インターバル |

sulfur.on("opened", (url, collect, send) => {
  // ...
});

Event:'closed'

統計情報収集を終了した場合のイベント

| Name | Type | Description | | --------------- | ------ | ---------------- | | countsOfCollect | number | 統計情報収集回数 | | countsOfSend | number | 統計情報送信回数 |

sulfur.on("closed", (countsOfCollect, countsOfSend) => {
  // ...
});

値の取得方法

| 項目 | 取得方法 | | ------------ | ---------------------------------------------- | | peerId | Peer.id | | remoteId | MediaConnection.remoteId | | apikey | Peer.options.key | | additionalId | 不明 | | stats | MediaConnection.getPeerConnection().getStats() |

フィルタ処理

RTCStats のデータは getStats で取得し以下の条件でフィルタしたデータを送信する

| type | 個数 | 条件 | | ---------------- | ---- | ---------------------------------------- | | transport | 1 | dtlsState == 'connected' or 'connecting' | | candidate-pair | 1 | id == transport.selectedCandidatePairId | | local-candidate | 1 | id == candidate-pair.localCandidateId | | remote-candidate | 1 | id == candidate-pair.remoteCandidateId | | inbound-rtp | 2 | transportId == transport.id | | track | 2 | id == inbound-rtp.trackId | | codec | 2 | id == inbound-rtp.codecId |