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

@zucker-framework/media

v1.0.16

Published

Image/SVG helpers and server-side media orchestration. Existing browser-safe exports are in `src/browser.ts`; package browser conditions select that entry and do not load Node processes/filesystem or native SDKs.

Readme

@zucker-framework/media

Image/SVG helpers and server-side media orchestration. Existing browser-safe exports are in src/browser.ts; package browser conditions select that entry and do not load Node processes/filesystem or native SDKs.

BrowserPool (Node entry, unreleased)

import { BrowserPool } from '@zucker-framework/media';
import { chromium } from 'playwright'; // owned by the consumer

const pool = new BrowserPool(() => chromium.launch({ headless: true }));
const context = await pool.createContext('unique-job-id', { viewport: { width: 1280, height: 720 } });
try {
  const page = await context.newPage();
  // Product rendering/navigation policy goes here.
} finally {
  await pool.closeContext('unique-job-id');
}
await pool.shutdown();

One shared launch per generation, independent contexts, atomic task-ID reservation, retry on the next acquisition after launch failure, and recovery on disconnect. No automatic replay of failed jobs. Instantiate once in the application's composition root; the library has no global singleton, environment lookup, executable discovery or sandbox-disabling flags.

shutdown() is idempotent, rejects new acquisitions, waits for launches/context creations/in-progress closes, closes contexts then browser, and reports cleanup errors with AggregateError. A shutdown waits for resource creation, not application jobs: the application must drain jobs before shutdown if those jobs must finish. closeContext failures propagate, while bookkeeping is released. Launch and context promises must settle; this pool does not invent an unsafe timeout that abandons resources.

The structural PoolBrowser/PoolContext ports accept Playwright without a Framework runtime/SDK dependency. getBrowser() exposes the neutral browser port; use contexts for job work.

DocumentTextExtractor (Node entry, unreleased)

DocumentTextExtractor(ports, options).extract(buffer, format, signal?), with format pdf | docx | doc | image, returns { text, pageCount?, ocrUsed }.

Ports:

  • pdf(buffer) returns { getText(), destroy() }, matching PDFParse's page-number/text result. Destroy is called once, including cancellation; the parser must settle getText when destroyed.
  • docx(buffer) returns raw text (e.g. Mammoth). zipEntries(buffer) must enumerate all members, exposing compressed bytes, uncompressed size, CRC, encryption flag and compression method. Do not pre-inflate members. validateDocumentZip validates count, individual/total expanded bytes, CRC and actual decompressed size, with a bounded inflater even for forged headers. Stored and deflated members are supported; encrypted/other methods fail closed.
  • image(buffer, { limitInputPixels, maxDimension }) must enforce pixel limit inside the decoder before allocation, apply orientation and return scaled PNG (e.g. Sharp). Framework cannot retroactively bound an already-decoded image.
  • office(buffer, 'doc' | 'docx', signal?) supplies the consumer's existing conversion/retry service. No Office installation, process or retry policy is hidden in the library.
  • Optional execute replaces the local command runner for tests/deployment adapters. The default executeDocumentCommand uses Node execFile, not a shell, propagates cancellation, timeout and bounded stdout/stderr failures, and waits for child close before settling so temporary files are not deleted under a live child.

All policies are explicit DocumentTextOptions: OCR page limit, text threshold, input pixels, image dimension, ZIP limits, OCR language, ordered segmentation modes, raster DPI, command timeout/buffer limit, optional temporary root. No filing-specific page count, language or prompt is built in. PDF text pages are preserved; only sparse pages are rasterized using Poppler pdftoppm then recognized with Tesseract. Raster dimensions are bounded by the smaller of the configured dimension and the square root of the pixel limit. Sparse OCR can try configured fallback segmentation modes. Temporary directories are removed in finally on success, error and cancellation. Abort is checked around non-cancellable SDK calls; an SDK call may still need to finish before cancellation settles.

The default command port requires installed Poppler and Tesseract/language data. The structural ports do not import Playwright, PDFParse, Mammoth, Sharp or AdmZip: these are consumer adapter dependencies, not missing mandatory library peers. Tested source integration uses existing Playwright 1.57, pdf-parse 2.x, Mammoth, Sharp and AdmZip. ZIP validation uses portable IEEE CRC-32 rather than a Node 22-only node:zlib.crc32 import, so the new default entry does not raise the library runtime requirement to the maintainer toolchain version.

DocumentTextError.code distinguishes INVALID_ZIP (with original cause) and OCR_PAGE_LIMIT for localized consumer handling. Other errors remain observable (including native ENOENT/abort errors); applications own localized HTTP error mapping, filename/MIME detection, Office retry policy and filing limits. This API is not yet present in the published 1.0.4 artifact. Publish a new immutable version before migrating production consumers; do not use source links or version overrides to pretend it is released.

Word equations

readDocxDocumentText(documentXml) reads the body of word/document.xml as text and keeps Office Math equations as LaTeX ($…$ inline, $$…$$ display); ommlToLatex(xml) converts a single equation. Use them instead of a plain-text DOCX reader when the document may contain equations — those readers drop them silently. The caller unzips the DOCX and applies its own archive limits.