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 🙏

© 2024 – Pkg Stats / Ryan Hefner

itchio-metadata

v1.0.4

Published

A Node.js package to fetch and parse metadata for games hosted on Itch.io, providing detailed information about the latest game versions.

Downloads

2

Readme

🕹️ itchio-metadata

A Node.js package to grab and parse metadata for games on Itch.io, giving you all the details about the latest game versions.

📦 Installation

To get the package, just run:

npm install itchio-metadata

🚀 Usage

First, set up your environment variables in a .env.local file: You can set the ENV variables in your .env.local file as shown below or pass them directly to the fetchItchGameData function.

ITCH_API_KEY=

Example Usage

Here’s a quick example of how to use fetchItchGameData:

import * as dotenv from "dotenv";
import { fetchItchGameData } from "itchio-metadata";
dotenv.config({ path: ".env.local" });

async function exampleUsage() {
  try {
    const latestVersionInfoResult = await fetchItchGameData({
      author: "baraklava",
      gameTitle: "manic-miners",
      itchApiKey: process.env.ITCH_API_KEY,
    });
    console.log(latestVersionInfoResult);
    console.log(`[INFO] Successfully fetched game metadata from Itch.io`);
  } catch (error) {
    console.error(
      `[ERROR] An error occurred while fetching game metadata:`,
      error
    );
  }
}

exampleUsage().catch((err) =>
  console.error(`[ERROR] Failed to execute example usage:`, err)
);

If ITCH_API_KEY is set in the .env.local file, you can use the function like this:

const latestVersionInfoResult = await fetchItchGameData({
  author: "baraklava",
  gameTitle: "manic-miners",
});

You can also use the gameUrl parameter directly:

const latestVersionInfoResult = await fetchItchGameData({
  gameUrl: "https://baraklava.itch.io/manic-miners",
});

Environment Variables

  • ITCH_API_KEY: Your Itch.io API key (optional but recommended for fetching upload data).

📘 API

fetchItchGameData

Fetches metadata for a game hosted on Itch.io.

Parameters

  • FetchGameDataParams: An object with the following optional properties:
    • itchApiKey (string): Your Itch.io API key.
    • author (string): The author of the game.
    • gameTitle (string): The title of the game.
    • gameUrl (string): The full URL of the game's Itch.io page.

Returns

  • Promise<GameMetadata>: A promise that resolves to the game metadata.

Interfaces

GameMetadata

export interface GameMetadata {
  gameId: number;
  title: string;
  description: string;
  coverImage: string;
  gamePage: string;
  comments: string;
  latestVersion: {
    displayName: string;
    versionId: number;
    releaseDate: Date;
    sizeBytes: number;
    sizeMB: number;
    downloadUrl: string;
    md5Hash: string;
    platforms: {
      windows: boolean;
      mac: boolean;
      linux: boolean;
      android: boolean;
    };
    preorder: boolean;
    position: number;
    filename: string;
    demo: boolean;
    createdAt: Date;
    storage: string;
    type: string;
  };
  authors: Array<{ name: string; url: string }>;
}

FetchGameDataParams

export interface FetchGameDataParams {
  itchApiKey?: string;
  author?: string;
  gameTitle?: string;
  gameUrl?: string;
}

🛠️ Development

Building the Package

To build the package, run:

npm run build

Running the Example

To run the example usage, first ensure you have set up your .env.local file with the necessary environment variables, then run:

npm start

📜 License

This project is licensed under the MIT License

✨ Author

Waleed Judah

📌 Links