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

@proj-airi/unplugin-fetch

v0.2.6

Published

Vite plugin to download files

Readme

@proj-airi/unplugin-fetch

Helper plugin for helping installing the remote assets into public dir.

[!NOTE]

This project is part of (and also associate to) the Project AIRI, we aim to build a LLM-driven VTuber like Neuro-sama (subscribe if you didn't!) if you are interested in, please do give it a try on live demo.

Installation

Pick the package manager of your choice:

ni @proj-airi/unplugin-fetch -D # from @antfu/ni, can be installed via `npm i -g @antfu/ni`
pnpm i @proj-airi/unplugin-fetch -D
yarn i @proj-airi/unplugin-fetch -D
npm i @proj-airi/unplugin-fetch -D

UnoCSS usage

import { defineConfig } from 'vite'

import { Download } from '@proj-airi/unplugin-fetch/vite'

export default defineConfig({
  plugins: [
    Download('https://dist.ayaka.moe/live2d-models/hiyori_free_zh.zip', 'hiyori_free_zh.zip', 'assets/live2d/models'),
    Download('https://dist.ayaka.moe/live2d-models/hiyori_pro_zh.zip', 'hiyori_pro_zh.zip', 'assets/live2d/models'),
  ]
})

cacheDir and parentDir can be absolute paths if you want to share cache across packages (for example const sharedCacheDir = resolve(join(import.meta.dirname, '..', '..', '.cache'))). Absolute values are used as-is; relative values are resolved against config.root. When parentDir: false, assets are copied to config.root/<destination> instead of being skipped.

Progress and timeout

On an interactive terminal every download of one config shares a single line, rewritten in place, so a long transfer never looks stuck:

Downloading preload.data...
Downloading hiyori_free_zh.zip...
0/2 files   43% ██████████░░░░░░░░░░░░░░░░░░  1.3 MiB / 3.0 MiB  1.3 MiB/s  ETA 0:01
hiyori_free_zh.zip downloaded in 1.5s.
hiyori_free_zh.zip copied to /path/to/public.
preload.data   84% ██████████████████████░░░  2.6 MiB / 3.0 MiB  1.1 MiB/s  ETA 0:01
preload.data downloaded in 3.1s.
preload.data copied to /path/to/public.

The percentage counts the bytes of every file still downloading plus the ones that already finished, so one line covers the whole set even though the downloads run concurrently. When a server sends no content-length, the bar is replaced by a spinner and the received byte count. The line gives up detail before it wraps: the ETA goes first, then the speed and the total size, and only then is the file name shortened.

Terminals that implement the ConEmu/Windows Terminal progress sequence (OSC 9;4) additionally show the same progress in the tab header and on the taskbar, cleared once the downloads finish.

Output that is not a terminal — a pipe, CI, --silent, or a custom Vite logger — gets one line per file per second instead:

preload.data: 42% (95.1 MiB / 226.2 MiB)

idleTimeout aborts a download that stops sending data. It defaults to 30000 milliseconds. Only silence between chunks counts, so a slow link to a large file is not treated as a failure. Raise it when a server pauses for long stretches:

Download(url, 'preload.data', 'assets/models', { idleTimeout: 120_000 })

A download is written to <filename>.part and renamed when it completes. An interrupted download therefore leaves no file that a later run would treat as cached.

retries downloads the file again after a network error, a stall, a truncated body, or an HTTP 408, 425, 429, or 5xx status. It defaults to 3. The waits between attempts are 1 s, 2 s, 4 s, and so on. Other 4xx statuses, such as 404, fail at once:

Download(url, 'preload.data', 'assets/models', { retries: 5 })

Other side projects born from Project AIRI