@modrinth-ts/mrpack
v2.3.1
Published
TypeScript parser for .mrpack files, Modrinth's modpacks
Downloads
23
Readme
⬇️ Installing
npm install @modrinth-ts/mrpackbun add @modrinth-ts/mrpackpnpm add @modrinth-ts/mrpackyarn 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.
