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

@dhanuwrdhn/binar

v0.1.10

Published

Binar — in-app HTTP inspector for React Native. Captures fetch, axios and XMLHttpRequest traffic.

Readme


See every HTTP call your app makes, from inside your app. Binar captures fetch, axios, and raw XMLHttpRequest traffic and shows it on an in-app screen — call list, then tap through to headers, bodies, status, and timing. A floating bubble tells you when requests fire.

One patch, three clients

In React Native, fetch is a polyfill built on XMLHttpRequest, and axios ships an XHR adapter. Binar patches XHR once and wraps fetch for full body access, using an internal dedupe marker so a single call is never recorded twice.

Axios needs zero configuration. So does everything else.

Install

npm install @dhanuwrdhn/binar

Metro transpiles the TypeScript source directly — there is no build step.

Running Jest in the host app? Add the package to transformIgnorePatterns, or Jest will fail to parse the shipped TypeScript.

Wire it in

1. Install the interceptors — as early as possible, before the first request fires.

// index.js
import { Binar } from '@dhanuwrdhn/binar';

Binar.init({ showNotification: true });

2. Wrap your app root. The inspector renders as a Modal, so no navigator is required.

import { BinarProvider } from '@dhanuwrdhn/binar';

export default function App() {
  return (
    <BinarProvider>
      <YourApp />
    </BinarProvider>
  );
}

That's the whole setup. Fire requests and tap the bubble, or call Binar.open() from a debug menu.

API

Binar.init(config?)            // install interceptors (no-op when enabled: false)
Binar.open() / Binar.close()   // show or hide the inspector
Binar.setNotification(bool)    // toggle the floating bubble at runtime
Binar.setScreen(name | null)   // report the active app screen (see below)
Binar.clear()                  // wipe captured calls
Binar.uninstall()              // restore the original XHR and fetch

Config

| Option | Default | What it does | |---|---|---| | enabled | __DEV__ | When false, nothing is patched and every API is a no-op — safe to ship | | showNotification | true | Floating bubble with an unseen-call count; tap to open the inspector | | showScreenLabel | true | Floating pill with the active screen name; only appears once Binar.setScreen is wired | | maxCallsCount | 1000 | Ring buffer size; oldest calls are evicted first | | maxBodySize | 1_000_000 | Bodies longer than this (in chars) are truncated with a marker | | redactedHeaders | authorization, cookie, set-cookie | Values render as ***, matched case-insensitively | | redactedBodyFields | password, token, secret, api_key, card_number, cvv, and a few more | JSON body fields at any nesting depth render as ***, matched case-insensitively. Only applies to bodies that parse as JSON | | ignoredUrls | [] | Strings or RegExps to skip; Metro's /symbolicate noise is skipped already |

Screen label (Alice-style)

Tell Binar which screen is active and it shows a draggable floating pill with the route name (/Home) on top of your app — and stamps every captured call with the screen that fired it (visible in the call list and detail Overview).

With react-navigation:

import { createNavigationContainerRef } from '@react-navigation/native';
import { Binar } from '@dhanuwrdhn/binar';

const navRef = createNavigationContainerRef();
const reportScreen = () => Binar.setScreen(navRef.getCurrentRoute()?.name ?? null);

<NavigationContainer ref={navRef} onReady={reportScreen} onStateChange={reportScreen}>

setScreen is a no-op when Binar is disabled, so the wiring is safe in release builds.

Mounting as a route

BinarProvider needs no navigator. If you'd rather give the inspector its own route:

import { BinarScreen } from '@dhanuwrdhn/binar';

<Stack.Screen name="BinarInspector" component={BinarScreen} />
// navigation.navigate('BinarInspector')

Example app

example/ is a runnable app wiring up fetch, axios, and raw XHR side by side.

What Binar does not do

  • Native traffic stays invisible. Requests from native SDKs (Firebase, native networking libraries) never pass through JS, so they are not captured.
  • It is a dev tool. enabled defaults to __DEV__. Leave it that way.
  • Nothing persists. Captured calls live in memory and disappear on reload.
  • The dedupe marker. Binar adds x-binar-trace to fetch requests and strips it at the XHR layer before sending, so it never reaches your server under RN's default fetch. Replace the fetch polyfill with a non-XHR transport and capture still works, but the marker may go out — strip it in your transport or ignore it server-side in dev.

Development

npm install
npm test          # store, redaction, XHR and fetch interceptors
npm run typecheck

License

MIT © Dhanu Wardhana