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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@moontaiworks/fanbox-dl

v1.0.1

Published

A TypeScript PixivFanbox Downloader and SDK

Downloads

295

Readme

@moontaiworks/fanbox-dl

A cli downloader or a read-only TypeScript SDK for building pixivFANBOX applications.

NPM Version NPM Downloads Documentation codecov

CLI Downloader

Run the downloader through your package manager, or install it globally:

npx @moontaiworks/fanbox-dl download --creator creator-id
npm install -g @moontaiworks/fanbox-dl
fanbox-dl download --creator creator-id

Authenticated downloads read FANBOX_SESSION_ID by default:

FANBOX_SESSION_ID=your-session-id npx @moontaiworks/fanbox-dl download \
  --supporting \
  --output ./fanbox-downloads

You can also pass a cookie file exported from your logged-in browser session:

npx @moontaiworks/fanbox-dl download \
  --creator creator-id \
  --cookie-file ./cookies.txt

Preview the selected creators and posts without downloading:

npx @moontaiworks/fanbox-dl download --creator creator-id --dry-run

At least one creator selector is required: --creator, --following, or --supporting.

CLI Options

| Option | Description | Example | Default | | --------------------------- | ------------------------------------------------------------------------------------------------------ | -------------------------------- | ------------------- | | --creator <id> | Add a creator ID to download. Can be repeated. | --creator alpha --creator beta | None | | --following | Download posts from followed creators. Requires authentication. | --following | false | | --supporting | Download posts from supporting creators. Requires authentication. | --supporting | false | | --ignore-creator <id> | Exclude a creator ID from the selected creators. Can be repeated. | --ignore-creator beta | None | | --cookie <value> | Raw FANBOXSESSID, FANBOXSESSID=..., or a full Cookie header. | --cookie "FANBOXSESSID=..." | FANBOX_SESSION_ID | | --cookie-file <path> | Read a raw cookie value or Netscape cookies.txt. FANBOX cookies are selected automatically. | --cookie-file ./cookies.txt | None | | --user-agent <value> | Send the same User-Agent as the browser session that produced your cookie. | --user-agent "Mozilla/5.0 ..." | random string | | --output <path> | Directory where downloaded creators and posts are stored. | --output ./fanbox-downloads | fanbox-downloads | | --dry-run | List selected creators and discovered post summaries without writing files or requesting post details. | --dry-run | false | | --flat-posts | Store post files directly under each creator directory instead of one directory per post. | --flat-posts | false | | --verify-assets | Verify existing asset size and SHA-256 before deciding whether to skip a file. | --verify-assets | false | | --concurrency <n> | Maximum number of concurrent requests. Must be greater than 0. | --concurrency 3 | 3 | | --request-interval-ms <n> | Delay between request starts, in milliseconds. | --request-interval-ms 1000 | 0 | | --rate-limit-pause-ms <n> | Pause duration after HTTP 429 when FANBOX does not send Retry-After. | --rate-limit-pause-ms 60000 | 60000 | | --max-retries <n> | Retry attempts for retryable request failures. | --max-retries 5 | 5 | | --log-format json\|pretty | Choose JSON Lines logs or human-readable logs. | --log-format pretty | json | | --log-level <level> | Show logs at this level or higher. One of debug, info, warn, or error. | --log-level debug | info | | --help | Show CLI help. | --help | None |

CLI Notes

The downloader stores each post as metadata.json, content.md, and asset files in a per-post directory. Asset file names include a two-digit sequence number, so files are easy to browse in order.

It keeps a per-creator manifest.json, skips unchanged posts, resumes .part files with HTTP Range requests when supported, and can verify existing SHA-256 hashes with --verify-assets.

Passing --cookie is convenient but may leave the session value in shell history. --cookie-file accepts either a raw cookie value or a Netscape cookies.txt export from your own logged-in browser session. When using cookies.txt, FANBOX cookies such as FANBOXSESSID and cf_clearance are selected automatically.

Run fanbox-dl --help for the full CLI option list.

SDK

Installation

npm install @moontaiworks/fanbox-dl

Usage

FANBOX uses the FANBOXSESSID cookie for authenticated requests. Obtain it from your own browser session and keep it outside source control.

import { FanboxClient } from "@moontaiworks/fanbox-dl";

const fanbox = new FanboxClient({
  cookie: `FANBOXSESSID=${process.env.FANBOX_SESSION_ID}`,
});

const creators = await fanbox.listFollowingCreators();
const supportingPlans = await fanbox.listSupportingPlans();

const pageUrls = await fanbox.paginateCreatorPosts({
  creatorId: creators[0].creatorId,
  sort: "newest",
});

const posts = await fanbox.listCreatorPosts({
  creatorId: supportingPlans[0].creatorId,
  limit: 10,
  sort: "newest",
});

const post = await fanbox.getPost({ postId: posts[0].id });

The SDK also provides listHomePosts() and listSupportingPosts() for authenticated timelines. It intentionally exposes read-only endpoints: it does not follow creators, like posts, or create comments.

Documentation

API documentation is automatically generated using TypeDoc and published to GitHub Pages.

Testing

Tests inject a local HTTP transport and do not require a real FANBOX session.

Run:

pnpm test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.