/modrinth

JavaScript library for accessing the Modrinth API

Primary LanguageTypeScriptApache License 2.0Apache-2.0

Not currently maintained due to a dispute with the Modrinth Team and other related individuals.

If you're interested in maintaining this package, feel free to contact me on Discord. support inquries will be ignored.

Modrinth.js

JavaScript library for accessing the Modrinth API.

Discord Maintenance GitHub issues npm bundle size (scoped) NPM

Disclaimer: This package is in no way an official package, nor will you recieve support from the Modrinth Team in any official capacity for using this package. Any and all problems or support should be directed to Ruby, our issue tracker, or other contributors.

Resources

Website - Documentation - Source - Discord

Install

Available on NPM: Modrinth.js

Ruby's recommended package manager:
pnpm: 📦🚀 Fast, disk space efficient package manager.

pnpm install modrinth or npm install modrinth.

Examples

import { Modrinth } from "modrinth";

const modrinth = new Modrinth({
    // GitHub access token, optional.
    authorization: "..." 
});

modrinth.user("rubybb"); // Promise<User>
modrinth.user("suMONnLn"); // Promise<User>
modrinth.users(["rubybb", "jellysquid3"]); // Promise<[User, User]>
modrinth.users(["rubybb", "TEZXhE2U"]); // Promise<[User, User]>

modrinth.mod("lambdynamiclights"); // Promise<Mod>
modrinth.mod("yBW8D80W"); // Promise<Mod>
modrinth.mods(["lambdynamiclights", "sodium"]); // Promise<[Mod, Mod]>

modrinth.version("hKXQNf9z"); // Promise<Version>
modrinth.versions(["YuZK7F05", "hKXQNf9z"]); // Promise<[Version, Version>]

modrinth.user("jellysquid3").then(async user => {
    const mods = await user.mods();
    console.log(mods);

    /* 
    * something like this. :) 
    * for the actual object returned, take a look at the documentation.
    * https://modrinth.js.org/classes/mod.html
    */
    [
        {
            id: "AANobbMI",
            slug: "sodium",
            title: "Sodium",
            status: "approved",
            downloads: 1490,
            ...
        },
        ...
    ]
});