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

gstinfo

v0.0.3

Published

中文 | English

Readme

gstinfo - Get SillyTavern Info

中文 | English

中文说明

项目简介

gstinfo 是一个用于解析 SillyTavern 数据文件的 TypeScript 库,支持以下输入:

  • 角色卡(PNG / JSON)
  • 世界书(JSON,或从角色卡中自动提取绑定世界书)
  • 预设(JSON)

仓库地址

  • Gitee: https://gitee.com/al01/gstinfo
  • GitHub: https://github.com/al01cn/gstinfo

项目结构

gstinfo/
  dist/
    index.js
    index.global.js
    index.d.ts
  src/
    index.ts
  package.json
  tsconfig.json

安装

如果你从包管理器使用:

npm install gstinfo
yarn add gstinfo
pnpm add gstinfo
bun add gstinfo

如果你在当前仓库本地开发:

cd gstinfo
bun install

构建与类型检查

cd gstinfo
bun run build
bunx tsc --noEmit

使用方式

输入规则(统一 API)

  • getCharacterInfo(input)
  • getWorldInfo(input)
  • getPresetsInfo(input)

三个函数在 Node 与浏览器下保持同一签名,均为 input 单参数。

  • Node.js:支持 文件路径(string)Buffer(Uint8Array)Uint8ArrayArrayBuffer
  • 浏览器:支持 File/BlobUint8ArrayArrayBuffer

Node.js(工程化)

import { getCharacterInfo, getWorldInfo, getPresetsInfo } from "gstinfo";

const character = await getCharacterInfo("path/to/character.png");
const world = await getWorldInfo("path/to/world.json");
const preset = await getPresetsInfo("path/to/preset.json");
import { readFile } from "node:fs/promises";
import { getCharacterInfo } from "gstinfo";

const buf = await readFile("path/to/character.png");
const character = await getCharacterInfo(buf);

浏览器(工程化)

import { getCharacterInfo } from "gstinfo";

const input = document.querySelector<HTMLInputElement>("#fileInput");
const file = input?.files?.[0];
if (file) {
  const character = await getCharacterInfo(file);
  console.log(character);
}

浏览器(CDN 引入)

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.global.js"></script>
<script>
  const input = document.getElementById("fileInput");
  input.addEventListener("change", async (event) => {
    const file = event.target.files?.[0];
    if (!file) return;
    const character = await GSTInfo.getCharacterInfo(file);
    console.log(character);
  });
</script>

快速开始(通用)

import {
  getCharacterInfo,
  getWorldInfo,
  getPresetsInfo,
  getValueByPath,
  isCharacterInfo,
  isWorldInfo,
  isPresetsInfo,
} from "./src/index.ts";

const character = await getCharacterInfo("path/to/character.png");
const world = await getWorldInfo("path/to/character.png");
const preset = await getPresetsInfo("path/to/preset.json");

const firstEntryContent = getValueByPath<string>(
  character,
  "worldInfo.entries[0].content",
  ""
);

const isValid =
  isCharacterInfo(character) &&
  isWorldInfo(world) &&
  isPresetsInfo(preset);

核心 API

  • getCharacterInfo(file):返回结构化角色信息 CharacterInfo
  • getWorldInfo(file):返回结构化世界书信息 WorldInfo
  • getPresetsInfo(file):返回结构化预设信息 PresetsInfo
  • getValueByPath(obj, path, defaultValue):按路径安全读取任意字段
  • isCharacterInfo / isWorldInfo / isPresetsInfo:模型类型守卫

数据模型

  • CharacterInfo:角色基础字段、标签、世界书聚合、原始数据
  • WorldInfo:世界书名称、条目列表、条目数量、原始数据
  • WorldEntryInfo:世界书条目标准化字段(关键词、内容、开关等)
  • PresetsInfo:预设来源、模型、采样参数、上下文参数、原始数据

技术栈

  • TypeScript
  • Bun
  • Node.js 内置模块(fs/promiseszlib

English

Overview

gstinfo is a TypeScript library for parsing SillyTavern-related data files:

  • Character cards (PNG / JSON)
  • World books (JSON, or auto-extracted from character cards)
  • Presets (JSON)

Repository

  • Gitee: https://gitee.com/al01/gstinfo
  • GitHub: https://github.com/al01cn/gstinfo

Project Structure

gstinfo/
  dist/
    index.js
    index.global.js
    index.d.ts
  src/
    index.ts
  package.json
  tsconfig.json

Installation

From a package manager:

npm install gstinfo
yarn add gstinfo
pnpm add gstinfo
bun add gstinfo

For local development in this repository:

cd gstinfo
bun install

Build and Type Check

cd gstinfo
bun run build
bunx tsc --noEmit

Usage

Unified Input API

  • getCharacterInfo(input)
  • getWorldInfo(input)
  • getPresetsInfo(input)

The three functions share the same one-argument signature across Node and browsers.

  • Node.js: path(string), Buffer(Uint8Array), Uint8Array, ArrayBuffer
  • Browser: File/Blob, Uint8Array, ArrayBuffer

Node.js (Bundler/Runtime)

import { getCharacterInfo, getWorldInfo, getPresetsInfo } from "gstinfo";

const character = await getCharacterInfo("path/to/character.png");
const world = await getWorldInfo("path/to/world.json");
const preset = await getPresetsInfo("path/to/preset.json");
import { readFile } from "node:fs/promises";
import { getCharacterInfo } from "gstinfo";

const buf = await readFile("path/to/character.png");
const character = await getCharacterInfo(buf);

Browser (Bundler)

import { getCharacterInfo } from "gstinfo";

const input = document.querySelector<HTMLInputElement>("#fileInput");
const file = input?.files?.[0];
if (file) {
  const character = await getCharacterInfo(file);
  console.log(character);
}

Browser (CDN)

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/index.global.js"></script>
<script>
  const input = document.getElementById("fileInput");
  input.addEventListener("change", async (event) => {
    const file = event.target.files?.[0];
    if (!file) return;
    const character = await GSTInfo.getCharacterInfo(file);
    console.log(character);
  });
</script>

Quick Start (Generic)

import {
  getCharacterInfo,
  getWorldInfo,
  getPresetsInfo,
  getValueByPath,
  isCharacterInfo,
  isWorldInfo,
  isPresetsInfo,
} from "./src/index.ts";

const character = await getCharacterInfo("path/to/character.png");
const world = await getWorldInfo("path/to/character.png");
const preset = await getPresetsInfo("path/to/preset.json");

const firstEntryContent = getValueByPath<string>(
  character,
  "worldInfo.entries[0].content",
  ""
);

const isValid =
  isCharacterInfo(character) &&
  isWorldInfo(world) &&
  isPresetsInfo(preset);

Core API

  • getCharacterInfo(file): returns structured character info (CharacterInfo)
  • getWorldInfo(file): returns structured world-book info (WorldInfo)
  • getPresetsInfo(file): returns structured preset info (PresetsInfo)
  • getValueByPath(obj, path, defaultValue): safely access nested values
  • isCharacterInfo / isWorldInfo / isPresetsInfo: type guards

Data Models

  • CharacterInfo: core character fields, tags, world-book aggregate, raw data
  • WorldInfo: world-book name, entries, entry count, raw data
  • WorldEntryInfo: normalized world entry fields (keys, content, enabled, etc.)
  • PresetsInfo: source, model, sampling/context params, raw data

Tech Stack

  • TypeScript
  • Bun
  • Node.js built-in modules (fs/promises, zlib)