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

@raghavendra_kj/stt-js

v1.0.7

Published

A wrapper around the Web Speech API for speech-to-text functionality.

Readme

Speech-to-Text (STT) Library

Live Demo

You can view a live demo of the example here.

Introduction

The Speech-to-Text (STT) library provides a clean interface for integrating browser-based speech recognition into your web applications using the Web Speech API. It supports real-time transcription, interim results, and continuous listening.

Installation

npm install @raghavendra_kj/stt-js

Usage

Import the Library

import { STT } from "@raghavendra_kj/stt-js";

Create an Instance

const stt = new STT();

Start Recognition

await stt.start();

You can also pass options:

await stt.start({
  lang: "en-IN",
  continuous: false,
  interimResults: false
});

Stop or Abort Recognition

stt.stop(); // Gracefully ends recognition
stt.abort(); // Forcibly ends recognition

Add Event Listeners

stt.onResult((text) => {
  console.log("Final result:", text);
});

stt.onPartialResult((text) => {
  console.log("Interim result:", text);
});

stt.onError((error) => {
  console.error("Error occurred:", error);
});

Remove Event Listeners

stt.offResult(handler); // Remove a specific listener
stt.removeAllListeners(); // Remove all listeners

API Reference

STT.start(options?)

Starts speech recognition.

Parameters:

  • lang (string): Language code (default: "en-US")
  • continuous (boolean): If recognition should continue after pauses (default: true)
  • interimResults (boolean): Whether to include interim results (default: true)

Returns: Promise<void>

STT.stop()

Stops the recognition session gracefully.

STT.abort()

Forcibly aborts the recognition session.

STT.isRecognizing()

Returns a boolean indicating whether recognition is currently active.

STT.dispose()

Stops recognition and removes all listeners. Use for cleanup.

Event Listeners

Add Listeners

  • stt.onStart(handler: () => void): Triggered when recognition starts.
  • stt.onEnd(handler: () => void): Triggered when recognition ends.
  • stt.onResult(handler: (text: string) => void): Triggered when a final transcript is available.
  • stt.onPartialResult(handler: (text: string) => void): Triggered for interim transcript updates.
  • stt.onError(handler: (error: STTError) => void): Triggered when an error occurs.

Remove Listeners

  • stt.offStart(handler: () => void): Removes a specific "start" listener.
  • stt.offEnd(handler: () => void): Removes a specific "end" listener.
  • stt.offResult(handler: (text: string) => void): Removes a specific "result" listener.
  • stt.offPartialResult(handler: (text: string) => void): Removes a specific "partialResult" listener.
  • stt.offError(handler: (error: STTError) => void): Removes a specific "error" listener.
  • stt.removeAllListeners(event?): Removes all listeners for a specific event or all events.

Permissions

If supported, the library uses the Permissions API to check for microphone access.

Errors are reported through the "error" events.

Browser Support

Ensure the target browser supports the Web Speech API (e.g., latest versions of Chrome, Edge).

Example

A complete working example is available in example/index.html.