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

tarsen-core

v0.1.0

Published

Static npm package analysis, risk scoring, and safe tarball helpers for Tarsen. No cloud, no telemetry.

Readme

tarsen-core

Static npm package analysis for Tarsen. Tarsen checks executable npm packages before developers or AI agents run them.

tarsen-core is a pure local analyzer. It never executes package code, never runs install scripts, and has no cloud connection or telemetry. It turns registry metadata and extracted source files into a stable JSON risk report that the CLI (or any other tool) can render.

What it provides

  • Registry metadata parsing (parseMetadata) — normalize a version manifest and packument into a typed PackageMetadata.
  • Static file scanning (scanContent, scanFiles) — pure string pattern detection for child processes, dynamic execution, env/filesystem/network access, and obfuscation. Never imports or evaluates the code it scans.
  • Safe tarball helpers (isTraversalAttempt, makeSafeFilter) — reject path traversal, drop symlinks/hardlinks, and enforce entry caps during extraction.
  • Risk scoring (scoreSignals, riskLevel, recommend) — deterministic mapping from signals to a low | medium | high | unknown band and a recommendation.
  • Report contract (RiskReport, analyzePackage, unknownReport) — the schema emitted by tarsen check --json.

Detection scope

Lifecycle scripts (preinstall, install, postinstall, prepare), child_process / exec( / spawn( / execSync( / spawnSync(, eval( / Function(, sensitive process.env, fs.readFile / fs.writeFile / fs.rm / fs.unlink, os.homedir(, fetch( / http.request / https.request / axios / XMLHttpRequest / WebSocket, large minified files, very long lines, base64-like blobs, missing repository/maintainers/description, very new packages, and one-edit typosquatting against common package names.

Usage

import { analyzePackage, parseMetadata } from "tarsen-core";

const metadata = parseMetadata(manifest, packument);
const report = analyzePackage(metadata, [
  { path: "index.js", content: "require('child_process').exec('whoami')" },
]);
// report.risk === "high"

Safety guarantees

This package only ever reads strings. It does not fetch from the network, execute code, or write anywhere — those concerns live in tarsen. The tar helpers are pure predicates and filter factories; the actual extraction is driven by the CLI into a temporary directory that it owns and cleans up.

License

Apache-2.0. See LICENSE.