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

sightengine-js

v0.6.0

Published

A fully-typed TypeScript SDK for the SightEngine content‑moderation API, with streaming support, threshold presets, and helper utilities.

Downloads

28

Readme

🔥 Features

  • Fully‑typed (TypeScript)
  • 📡 Stream image moderation
  • 🌐 URL image inputs
  • ⚙️ Threshold presets + custom thresholds
  • 🛠️ Helper utilities: isNSFW(), listFlaggedCategories()

📦 Installation

npm install sightengine-js
# or
yarn add sightengine-js

🚀 Quick Start

import { SightEngineClient, isNSFW, listFlaggedCategories } from "sightengine-js";

const sightengine = new SightEngineClient({
	apiSecret: "<your api secret>",
	apiUser: "<your api user>",
});

const imageModerationResult = await sightengine.moderateImage(
	"<path to your image>",
	[
		"nudity-2.1",
		"gore-2.0",
		"offensive-2.0",
	],
);

// URL-based
const urlImageModerationResult = await sightengine.moderateImageByUrl(
	"<image URL>",
	[
		"nudity-2.1",
		"gore-2.0",
		"offensive-2.0",
	],
);

console.log(listFlaggedCategories(imageModerationResult));
console.log(isNSFW(imageModerationResult));

📚 API Reference

new SightEngineClient(options)

| Property | Type | Description | |----------|--------|-------------------------------------------| | apiUser| string| Your SightEngine API user. | | apiSecret| string| Your SightEngine API secret. |

client.moderateImage(path, models?)

  • path – Local file system path to the image.
  • models – Array of model identifiers (default: ["nudity-2.1"]).

Returns a promise that resolves to ImageModerationResponse.

client.moderateImageByUrl(url, models?)

  • url – Direct URL to the image.
  • models – Same as above.

Returns a promise that resolves to ImageModerationResponse.

Types

  • ImageModerationResponse – Raw response from SightEngine (see src/types.ts).
  • NormalizedImageModerationResponse – Internal normalized shape used by helpers.

⚙️ Thresholds & Presets

import { DEFAULT_THRESHOLDS, PRESET_THRESHOLDS } from "sightengine-js";

// Example: use the strict preset
const thresholds = PRESET_THRESHOLDS.strict;

| Model | Default | |------------|---------| | nudity | 0.85 | | offensive| 0.5 | | gore | 0.5 | | violence | 0.5 | | self-harm| 0.5 |

🛠️ Helper Utilities

  • isNSFW(response, threshold?) – Returns true if any of the important categories (nudity, gore, violence, self-harm, sexual) exceed the given threshold.
  • listFlaggedCategories(response, thresholds?) – Returns an array of categories (and sub‑scores) that exceed the supplied thresholds.

Both functions accept the raw ImageModerationResponse from the client.

🤝 Contributing

  1. Fork the repo
  2. Create a feature branch (git checkout -b feat/...)
  3. Commit with Commitizen (npm run commit)
  4. Push & open a PR against develop
  5. Tests must pass, coverage ≥ 90%

📜 License

MIT © Ali Nazari