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

blekit

v0.1.0

Published

My new module

Readme

Blekit

blekit is a lightweight, dependency-free Bluetooth Low Energy (BLE) library for React Native and Expo. It is written in 100% pure Swift (utilizing CoreBluetooth) on iOS and 100% pure Kotlin (utilizing standard android.bluetooth) on Android.

It provides a drop-in replacement for the react-native-ble-plx API, removing all heavy reactive programming dependencies (such as RxBluetoothKit, RxAndroidBle, RxSwift, and RxJava) to deliver faster builds, a smaller bundle size, and fewer compilation issues.

Features

  • Bluetooth state monitoring.
  • Device scanning with UUID filtering.
  • Connection management (connect, disconnect, connection status, RSSI reading).
  • GATT Service and Characteristic discovery.
  • Characteristic read and write operations (with and without response).
  • Characteristic monitoring (notifications and indications).
  • Descriptor read and write operations.
  • MTU and connection priority requests.

Installation

npm install blekit
# or
yarn add blekit

Expo Configuration

Because this module contains custom native code, it cannot run in the standard Expo Go client. You must use Development Builds.

Add permissions to your Expo app.json or app.config.js:

{
  "expo": {
    "plugins": [
      [
        "expo-build-properties",
        {
          "ios": {
            "deploymentTarget": "16.4"
          }
        }
      ]
    ],
    "ios": {
      "infoPlist": {
        "NSBluetoothAlwaysUsageDescription": "This app uses Bluetooth to connect to BLE devices."
      }
    },
    "android": {
      "permissions": [
        "android.permission.BLUETOOTH",
        "android.permission.BLUETOOTH_ADMIN",
        "android.permission.BLUETOOTH_SCAN",
        "android.permission.BLUETOOTH_CONNECT",
        "android.permission.ACCESS_FINE_LOCATION"
      ]
    }
  }
}

Then prebuild and run:

npx expo prebuild
npx expo run:ios
npx expo run:android

Usage

Here is a quick example showing how to initialize the manager, scan for devices, connect, and read/write values.

import { BleManager, Device, Characteristic } from 'blekit';

// Initialize the manager (create it only once, usually as a singleton)
const manager = new BleManager();

// 1. Monitor Bluetooth state changes
const stateSub = manager.onStateChange((state) => {
  console.log('Bluetooth state changed:', state); // e.g., 'PoweredOn'
}, true);

// 2. Scan for devices
manager.startDeviceScan(null, null, (error, device) => {
  if (error) {
    console.error('Scan error:', error);
    return;
  }
  
  if (device) {
    console.log(`Discovered device: ${device.name} (${device.id})`);
    
    // Stop scanning when your target device is found
    if (device.name === 'MyBLEDevice') {
      manager.stopDeviceScan();
      connectToDevice(device);
    }
  }
});

// 3. Connect to device and discover services & characteristics
async function connectToDevice(device: Device) {
  try {
    console.log('Connecting...');
    const connectedDevice = await device.connect();
    console.log('Connected! Discovering services and characteristics...');
    
    await connectedDevice.discoverAllServicesAndCharacteristics();
    console.log('Discovered everything!');
    
    // Read a value
    const serviceUUID = '12345678-1234-5678-1234-567812345678';
    const charUUID = '87654321-4321-8765-4321-876543210987';
    
    const characteristic = await connectedDevice.readCharacteristicForService(
      serviceUUID,
      charUUID
    );
    console.log('Read base64 value:', characteristic.value);
    
    // Write a value (base64 encoded)
    const base64Value = 'SGVsbG8='; // 'Hello'
    await connectedDevice.writeCharacteristicWithResponseForService(
      serviceUUID,
      charUUID,
      base64Value
    );
    console.log('Write completed!');
    
    // Monitor characteristic value updates
    const monitorSub = connectedDevice.monitorCharacteristicForService(
      serviceUUID,
      charUUID,
      (err, char) => {
        if (err) {
          console.error('Notification error:', err);
          return;
        }
        console.log('New notified value:', char?.value);
      }
    );
    
  } catch (err) {
    console.error('Connection/GATT operations failed:', err);
  }
}

// 4. Cleanup when the manager is no longer needed
// manager.destroy();

API Difference from react-native-ble-plx

blekit maintains complete compatibility with the react-native-ble-plx API structure. You can replace:

import { BleManager } from 'react-native-ble-plx';

with:

import { BleManager } from 'blekit';

The underlying library takes care of translating your calls to native Swift/Kotlin commands without any third-party framework overhead.