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-downloader

v0.7.7

Published

Programatically download games from itch.io using Node

Downloads

16

Readme

Itchio-Downloader

GitHub Repository: itchio-downloader on GitHub

npm Package: itchio-downloader on npm

Itchio-Downloader is a Node.js package that enables you to programmatically download games from itch.io. This tool allows you to access and download any free game available on itch.io directly through URLs or by specifying the game's name and its author's username, all without the need for an API key, manual interaction, or the itch.io desktop application (GUI) and Butler.

Motivation

I created this tool to build a game launcher/updater for the public/free games that I love. I decided to release this tool so others could use it for similar projects or entirely new ideas. To the best of my knowledge, this is the only programmatic method of downloading itch.io games without requiring an API key, OAuth key, or being the game developer. This makes Itchio-Downloader a unique and useful tool for the community!

Features

  • Direct Downloads: Download games directly from itch.io using either a specific URL or by specifying the game's name and author. No need for the itch.io desktop GUI or Butler.
  • Batch Operations: Supports downloading multiple games in a single batch operation, simplifying the process of managing multiple downloads.
  • Customization: Offers customizable settings for file renaming and specifying download directories, allowing greater control over how and where your games are saved.
  • Simplicity: Designed to be easy to use, requiring only the game URL or the author's name and game title. This makes it accessible even for those who are not familiar with itch.io’s more complex tools.
  • No API Key Required: Operates without the need for an API key, making it straightforward to set up and start downloading games.

Installation

To install Itchio-Downloader, ensure you have Node.js and npm (or Yarn) installed on your computer. From your terminal, run:

npm install itchio-downloader
# or
yarn add itchio-downloader

Usage

Importing the package

const { downloadGame } = require('itchio-downloader');

Downloading a Single Game

You can download a single game by either specifying a URL or a combination of the game's name and its author's username:

// Using a direct URL:
await downloadGame({ itchGameUrl: 'https://baraklava.itch.io/manic-miners' });

// Using name and author and optional params:
await downloadGame({
   name: 'manic-miners',
   author: 'baraklava',
   desiredFileDirectory: 'full file path', // Optional
   cleanDirectory: true // Optional
});

Downloading Multiple Games

To download multiple games, provide an array of parameters for each game. You can mix URL and name/author specifications within the same operation:

async function downloadMultipleGames() {
   const gameParams = [
      { name: 'manic-miners', author: 'baraklava' },
      { itchGameUrl: 'https://anotherdev.itch.io/another-game' },
      { itchGameUrl: 'https://moregames.itch.io/better-game' }
   ];

   await downloadGame(gameParams);
}
downloadMultipleGames();

Command Line Usage

To use Itchio-Downloader from the command line:

  1. First, ensure the CLI is built:

    yarn build-cli
  2. Run the command with the required options. For example:

    itchio-downloader --name "manic miners" --author "baraklava"

    This command will start the download process and provide output similar to:

    Starting downloadGameSingle function...
    Game profile fetched successfully: https://baraklava.itch.io/manic-miners
    Download directory set C:\Users\Aquataze\AppData\Local\ItchDownloader\manic-miners
    Downloading...
    Download and file operations successful.
    Game Download Result: {
       status: true,
       message: 'Download and file operations successful.',
       filePath: 'C:\\Users\\Aquataze\\AppData\\Local\\ItchDownloader\\manic-miners\\ManicMinersV1.0.zip'
    }

Configuration Options

The downloadGame function accepts the following parameters within DownloadGameParams:

  • name: (Optional) The name of the game (used in conjunction with author).
  • author: (Optional) The author's username on itch.io (used with name

).

  • itchGameUrl: (Optional) Direct URL to the game's itch.io page.
  • desiredFileName: (Optional) Specify a custom filename for the downloaded file.
  • desiredFileDirectory: (Optional) Directory where the downloaded files should be saved.
  • cleanDirectory: (Optional) Whether to clean the directory before downloading the files.

Types

export type DownloadGameParams = {
   name?: string,
   author?: string,
   cleanDirectory?: boolean,
   desiredFileName?: string,
   desiredFileDirectory?: string,
   itchGameUrl?: string
};

export type DownloadGameResponse = {
   status: boolean,
   message: string,
   metaData?: IItchRecord,
   metadataPath?: string,
   filePath?: string
};

yarn test:downloadSingle --> example response

Single Game Download Result

const response = {
   status: true,
   message: 'Download and file operations successful.',
   metadataPath: 'C:\\Users\\Aquataze\\Desktop\\itchDownloader\\testOutput\\manic-miners\\manic-miners-metadata.json',
   filePath: 'C:\\Users\\Aquataze\\Desktop\\itchDownloader\\testOutput\\manic-miners\\ManicMinersV1.0.zip',
   metaData: {
      title: 'Manic Miners: A LEGO Rock Raiders remake',
      coverImage: 'https://img.itch.zone/aW1nLzEzMTQ1NzA1LnBuZw==/315x250%23c/i%2BJ4qs.png',
      authors: [[Object]],
      tags: [],
      id: 598634,
      commentsLink: 'https://baraklava.itch.io/manic-miners/comments',
      selfLink: 'https://baraklava.itch.io/manic-miners',
      author: 'baraklava',
      name: 'manic-miners',
      domain: '.itch.io',
      itchGameUrl: 'https://baraklava.itch.io/manic-miners',
      itchMetaDataUrl: 'https://baraklava.itch.io/manic-miners/data.json'
   }
};

Contributing

Contributions are welcome! Please fork the repository and submit pull requests with any enhancements. For major changes, open an issue first to discuss what you would like to change.

Ensure to update tests as appropriate.

License

Distributed under the ISC License.