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

@enslo/sd-metadata-lite

v1.1.0

Published

Lightweight AI image metadata reader for bookmarklets

Readme

@enslo/sd-metadata-lite

npm version license

🌐 日本語版はこちら

🔗 Live Demo

A lightweight, read-only metadata parser for AI-generated images. Designed for bookmarklets and userscripts where bundle size matters.

  • Tiny: 6,519 bytes minified IIFE build
  • Read-only: Extracts metadata and returns A1111-format text
  • Zero dependencies: Works in Node.js and browsers
  • 18+ tools: Supports all major AI image generation tools

[!TIP] Need write support, format conversion, or structured metadata? Use the full library instead.

Installation

npm install @enslo/sd-metadata-lite

Usage

ESM

import { parse } from '@enslo/sd-metadata-lite';

const response = await fetch(imageUrl);
const data = new Uint8Array(await response.arrayBuffer());
const text = parse(data);

if (text) {
  console.log(text);
  // masterpiece, best quality, 1girl
  // Negative prompt: lowres, bad quality
  // Steps: 20, Sampler: Euler a, CFG scale: 7, Seed: 12345, ...
}

Userscript

Load the IIFE build via @require:

// ==UserScript==
// @name        My Script
// @namespace   https://example.com
// @require     https://cdn.jsdelivr.net/npm/@enslo/[email protected]/dist/index.global.js
// ==/UserScript==

const response = await fetch(imageUrl);
const data = new Uint8Array(await response.arrayBuffer());
const text = sdml.parse(data);

if (text) {
  console.log(text);
}

[!TIP] Always pin to a specific version in @require for stability.

Bookmarklet

Most sites block external script loading via CSP. Instead, paste the IIFE bundle inline:

  1. Copy the contents of dist/index.global.js (or download from npm)
  2. Build your bookmarklet with the code inlined:
javascript:void(async()=>{/* paste contents of index.global.js here */;/* your code using sdml.parse() */})()

Since the IIFE assigns to var sdml, calling sdml.parse() works immediately after the inlined code.

API

parse(input: Uint8Array | ArrayBuffer): string

Parses metadata from an image and returns A1111-format text.

Parameters:

  • input - Image file data (PNG, JPEG, or WebP)

Returns:

  • A1111-format metadata string if metadata is found
  • Empty string ("") if no metadata is found or the format is unrecognized

Output Format

The output follows the Stable Diffusion WebUI (A1111) text format:

masterpiece, best quality, 1girl
Negative prompt: lowres, bad quality
Steps: 20, Sampler: Euler a, Schedule type: Karras, CFG scale: 7, Seed: 12345, Size: 512x768, Model hash: a1b2c3d4, Model: model.safetensors

Fields are included only when present in the source metadata.

Supported Tools

Reads PNG, JPEG, and WebP metadata from:

[!NOTE] * Implemented based on reference code analysis, not verified with actual sample files.

Globals

When loaded via <script> tag or userscript @require, the IIFE build exposes:

window.sdml.parse(input)

Contributing

See CONTRIBUTING.md for guidelines.

License

MIT