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 🙏

© 2025 – Pkg Stats / Ryan Hefner

mediapipe-nodejs

v1.2.1

Published

A Node.js library for running MediaPipe models that are typically browser-only. This package uses a local Express (web) server and Playwright (headless browser) to bridge the gap between Node.js and MediaPipe's browser-based APIs.

Readme

mediapipe-nodejs

A Node.js library for running MediaPipe models that are typically browser-only. This package uses a local Express (web) server and Playwright (headless browser) to bridge the gap between Node.js and MediaPipe's browser-based APIs.

npm Package Version

Currently supports:

  • Face Landmarker - Detect facial landmarks and features

More MediaPipe models will be added over time.

Features

  • Face Landmarker Model - Detect facial landmarks and features with advanced options:
    • Custom number of faces to detect
    • Crop region for area of interest detection
    • Image rotation support (applied after cropping)
    • Landmark visualization for debugging
  • Node.js Support - Enables MediaPipe models to run in Node.js environments
  • Custom Image Directory - Serve images from specified directory with customizable URL paths
  • Auto-Installation - Playwright automatically installed and launched, or use existing browser instance
  • TypeScript Support - Full type definitions included

Installation

npm install mediapipe-nodejs

You can also install mediapipe-nodejs with pnpm, yarn, or slnpm

Usage Example

import { startClient } from 'mediapipe-nodejs'

async function detectFaces() {
  // Start the MediaPipe client
  const mediapipe = await startClient({
    port: 8560,
    headless: true,
  })

  // Serve images from a directory
  mediapipe.attachImageDirection({
    url_prefix: '/images',
    directory: './uploads',
  })

  // Detect face landmarks and face blendshapes
  const result = await mediapipe.detectFaceLandmarks({
    image_url: '/images/face.jpg',
    num_faces: 1,
    draw_landmarks: true,
  })

  console.log('Faces detected:', result.faceLandmarks.length)

  // Clean up
  await mediapipe.close()
}

Complete usage example see test.ts

Typescript Signature

import { FaceLandmarkerResult } from '@mediapipe/tasks-vision'
import { Browser, Page } from 'playwright'

interface StartMediaPipeClientOptions {
  port: number
  /** default: true */
  auto_install_playwright?: boolean
  /** default: true */
  headless?: boolean
  /** auto launch chromium browser if no instance provided */
  browser?: Browser
}

function startMediaPipeClient(
  options: StartMediaPipeClientOptions,
): Promise<MediaPipeClient>

interface MediaPipeClient {
  attachImageDirection(options: {
    /** e.g. '/images' */
    url_prefix: string
    /** e.g. './uploads/' */
    directory: string
  }): void

  detectFaceLandmarks(
    options: DetectFaceLandmarksOptions,
  ): Promise<FaceLandmarkerResult>

  /** alias: stop, close */
  stop(): Promise<void>
  close(): Promise<void>

  /** for extended reuse */
  browser: Browser
  page: Page
}

interface DetectFaceLandmarksOptions {
  /** local url or internet url */
  image_url: string
  /** default: 1 */
  num_faces?: number
  /** area to crop for detection, coordinates are in [0,1] with 'left' < 'right' and 'top' < 'bottom' */
  crop_region?: {
    left: number
    top: number
    right: number
    bottom: number
  }
  /** applied after crop region of interest, in degrees */
  rotation?: number
  /** for debugging, default: false */
  draw_landmarks?: boolean
  /** for debugging, default: false */
  draw_bounding_box?: boolean
  /** for debugging, default: 'red' */
  draw_style?: string
  /** for debugging, default: 5 */
  draw_size?: number
}

License

This project is licensed with BSD-2-Clause

This is free, libre, and open-source software. It comes down to four essential freedoms [ref]:

  • The freedom to run the program as you wish, for any purpose
  • The freedom to study how the program works, and change it so it does your computing as you wish
  • The freedom to redistribute copies so you can help others
  • The freedom to distribute copies of your modified versions to others