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

@mindfield/capacitor-lsl

v1.0.0

Published

Capacitor 7 plugin for Lab Streaming Layer (LSL) — stream biosignal data from mobile devices to LabRecorder or any LSL-compatible receiver

Readme

@mindfield/capacitor-lsl

Capacitor 7 plugin for Lab Streaming Layer (LSL) — stream biosignal data from mobile devices to LabRecorder or any LSL-compatible receiver.

Installation

npm install @mindfield/capacitor-lsl
npx cap sync

Warning: Do NOT install cordova-plugin-lsl and @mindfield/capacitor-lsl in the same project. They share the same native libraries and will cause duplicate class conflicts.

Platforms

| Platform | Status | Notes | |----------|--------|-------| | Android | Supported | ARM64, ARMv7, x86_64 | | iOS | Supported | ARM64 (device + simulator) | | Web | Not supported | LSL requires native UDP multicast |

Quick Start

import { LSL } from '@mindfield/capacitor-lsl';

// Create an outlet
const { outletId } = await LSL.createOutlet({
  name: 'eSense_EDA',
  type: 'EDA',
  channelCount: 1,
  sampleRate: 5.0,
  channelFormat: 'float32',
  sourceId: 'esense-eda-001',
  metadata: {
    manufacturer: 'Mindfield Biosystems',
    device: 'eSense EDA',
    channels: [{ label: 'EDA', unit: 'microsiemens', type: 'EDA' }],
  },
});

// Show IP for KnownPeers config
const { ip } = await LSL.getDeviceIP();
console.log(`Add to lsl_api.cfg: KnownPeers = {${ip}}`);

// Push samples
await LSL.pushSample({
  outletId,
  data: [3.14],
});

// Push chunks (more efficient for high sample rates)
await LSL.pushChunk({
  outletId,
  data: [[3.14], [3.15], [3.16], [3.17], [3.18]],
});

// Check for consumers (LabRecorder etc.)
const { hasConsumers } = await LSL.hasConsumers({ outletId });

// Wait for a consumer to connect (blocking, with timeout)
const result = await LSL.waitForConsumers({ outletId, timeout: 30.0 });

// Cleanup
await LSL.destroyOutlet({ outletId });
// or: await LSL.destroyAllOutlets();

API Reference

Outlet Operations

| Method | Description | |--------|-------------| | createOutlet(options) | Create a new LSL outlet. Returns { outletId }. | | pushSample(options) | Push a single sample to an outlet. | | pushChunk(options) | Push a chunk of samples (single JNI/C call, more efficient). | | hasConsumers(options) | Check if any consumer is connected. Returns { hasConsumers }. | | waitForConsumers(options) | Wait for a consumer (blocking). Returns { hasConsumers }. | | destroyOutlet(options) | Destroy a specific outlet. | | destroyAllOutlets() | Destroy all outlets and release resources. |

Utility Operations

| Method | Description | |--------|-------------| | getLocalClock() | Get LSL monotonic clock time. Returns { timestamp }. | | getLibraryVersion() | Get liblsl version. Returns { version }. | | getProtocolVersion() | Get LSL protocol version. Returns { version }. | | getDeviceIP() | Get Wi-Fi IP address. Returns { ip }. |

Types

type ChannelFormat = 'float32' | 'double64' | 'int32' | 'int16' | 'int8' | 'string';

interface CreateOutletOptions {
  name: string;
  type: string;
  channelCount: number;
  sampleRate: number;
  channelFormat: ChannelFormat;
  sourceId?: string;
  metadata?: StreamMetadata;
}

interface StreamMetadata {
  manufacturer?: string;
  device?: string;
  channels?: ChannelInfo[];
}

interface ChannelInfo {
  label: string;
  unit: string;
  type: string;
}

Receiving LSL Streams on PC

  1. Install LabRecorder
  2. Get the device IP: const { ip } = await LSL.getDeviceIP()
  3. Add to lsl_api.cfg:
    [lab]
    KnownPeers = {192.168.1.100}
  4. Start LabRecorder — the stream should appear in the stream list

Migration from cordova-plugin-lsl

| Cordova | Capacitor | |---------|-----------| | LSL.createOutlet(options)string | LSL.createOutlet(options){ outletId: string } | | LSL.pushSample(outletId, data, ts) | LSL.pushSample({ outletId, data, timestamp }) | | LSL.pushChunk(outletId, data) | LSL.pushChunk({ outletId, data }) | | LSL.hasConsumers(outletId)boolean | LSL.hasConsumers({ outletId }){ hasConsumers } | | LSL.waitForConsumers(outletId, timeout) | LSL.waitForConsumers({ outletId, timeout }) | | LSL.destroyOutlet(outletId) | LSL.destroyOutlet({ outletId }) | | LSL.getLocalClock()number | LSL.getLocalClock(){ timestamp } | | LSL.getLibraryVersion()string | LSL.getLibraryVersion(){ version } | | LSL.getDeviceIP()string | LSL.getDeviceIP(){ ip } |

Key differences:

  • All parameters are passed as options objects (Capacitor convention)
  • All return values are wrapped in objects
  • Import from @mindfield/capacitor-lsl instead of global LSL variable

Architecture

TypeScript API (definitions.ts)
    │
    ├── Android: Kotlin Plugin (LslPlugin.kt)
    │       └── JNI Shim (de.mindfield.cordova.lsl.LSLPlugin.java)
    │               └── liblsl_jni.so → liblsl.so (pre-built C library)
    │
    └── iOS: Objective-C Plugin (LslPlugin.m)
            └── liblsl.xcframework (pre-built C library, direct C API calls)

License

MIT — Copyright (c) 2026 Mindfield Biosystems Ltd.