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

peg-memory

v2.0.0

Published

A peg memory toolkit for generating vivid memory images from default or custom peg lists.

Readme

peg-memory

peg-memory is a Node.js library for peg-based memorization. It ships with a default 1-100 peg list, lets people import custom lists, generates vivid memory scenes, and can create real local AI pictures when connected to a local image model server.

Install

npm install peg-memory

Use

import { list, importCustom, imager, saveImage } from "peg-memory";

const pegs = list();
console.log(pegs[28]); // Knife

const result = await imager(28, "American Revolution");

console.log(result.story);
console.log(result.explanation);

if (result.image) {
  await saveImage(result, "./revolution.png");
}

importCustom({
  1: "Sun",
  2: "Shoe",
  3: "Tree"
});

API

list()

Returns the active peg list.

defaultList()

Returns the built-in default peg list.

importCustom(customList, options?)

Imports a custom peg list.

  • customList: object keyed from 1 to 100
  • options.merge: defaults to true

When merge is true, missing pegs fall back to the default list.

resetList()

Restores the built-in default list.

getPeg(number)

Gets one peg by number.

imager(number, thing, options?)

Creates a mnemonic result for a peg and a thing to remember.

Returns:

{
  number: 28,
  peg: "Knife",
  thing: "American Revolution",
  story: "...",
  imagePrompt: "...",
  explanation: "...",
  provider: "fallback",
  svg: "<svg ...",
  dataUri: "data:image/svg+xml..."
}

The svg and dataUri fields give you a real generated image card even in fallback mode.

Text provider options:

  • fallback: always works locally with no AI setup
  • auto: tries Ollama, then OpenAI, then fallback
  • ollama: uses a local Ollama server
  • openai: uses the OpenAI API

By default, imager() also tries to use a local image server at http://127.0.0.1:7860. If none is running, it falls back without failing.

Image options:

  • image.enabled: turns on real image generation
  • image.provider: automatic1111, forge, or none
  • image.endpoint: defaults to http://127.0.0.1:7860
  • image.model: optional checkpoint/model name
  • image.width, image.height, image.steps, image.cfgScale, image.samplerName
  • image.promptPrefix: optional style prefix added to the generated prompt
  • image.negativePrompt: optional negative prompt

Example with Ollama:

const result = await imager(42, "photosynthesis", {
  provider: "ollama",
  model: "llama3.1:8b"
});

Example with OpenAI:

const result = await imager(42, "photosynthesis", {
  provider: "openai",
  apiKey: process.env.OPENAI_API_KEY
});

Example with a local Stable Diffusion WebUI or Forge server:

const result = await imager(42, "photosynthesis", {
  image: {
    provider: "automatic1111",
    endpoint: "http://127.0.0.1:7860",
    width: 1024,
    height: 1024,
    promptPrefix: "surreal educational illustration, highly detailed"
  }
});

console.log(result.image.dataUri);
await saveImage(result, "./photosynthesis.png");

imagers.batch(entries, options?)

Creates multiple mnemonic images at once.

const results = await imagers.batch([
  { number: 5, thing: "gravity" },
  { number: 12, thing: "mitosis" }
]);

Notes

  • The built-in fallback mode is dependency-free and works out of the box.
  • Local text AI and local image AI are optional.
  • For real local pictures, run a compatible local server such as Stable Diffusion WebUI or Forge with API access enabled.
  • The package targets Node.js 18+.