Skip to content

modrinth-ts/mrpack

Repository files navigation

@modrinth-ts/mrpack

TypeScript parser for .mrpack files, Modrinth's modpacks

⬇️ Installing

npm install @modrinth-ts/mrpack
bun add @modrinth-ts/mrpack
pnpm add @modrinth-ts/mrpack
yarn add @modrinth-ts/mrpack

📦 Importing

🧩 SDK

This is the main class you should use.

import { ModPack } from '@modrinth-ts/mrpack';

const modpack = await ModPack.fromUrl(
    'https://modrinth.com/modpack/fabulously-optimized'
);
const manifest = await modpack.manifest;

console.log(manifest.name); // "Fabulously Optimized"

📝 Schema

Validate an existing modrinth.index.json using the bundled Zod schema and get a typed value.

import {
    ModrinthIndexJSONSchema,
    type ModrinthIndexJSON
} from '@modrinth-ts/mrpack/schema';

const rawManifest = await Bun.file('modrinth.index.json').json();
const manifest = ModrinthIndexJSONSchema.parse(rawManifest);

console.log(manifest.name); // "My awesome modpack"

📖 Documentation - Complete API reference

Caution

If you implement an "import ZIP" feature or similar, make sure this field doesn't exit the Minecraft instance directory for security reasons. To do this, make sure it doesn't contain .. or start with a drive name (i.e., [A-Z]:/, [A-Z]:\, /, and \).

Any files uploaded to Modrinth are validated automatically to ensure they do not contain this.

About

TypeScript parser for .mrpack files, Modrinth's modpacks

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •