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

upload-to-bunny

v2.1.1

Published

Upload-to-Bunny is a Node.JS library designed to simplify and speed up the process of uploading directories to BunnyCDN storage.

Readme

Upload-to-Bunny

Upload-to-Bunny is a Node.JS library designed to simplify and speed up the process of uploading directories to BunnyCDN storage. With built-in support for parallel uploads and cleaning old files (with two strategies), this library makes it easy to keep your BunnyCDN storage up-to-date.

Features

  • Upload entire directories to BunnyCDN storage
  • Parallel uploads for faster transfers
  • Option to clean the destination before uploading ("simple" or "avoid-deletes")
  • Easily configurable with storage zone and access key
  • CLI for quick one-off uploads

Installation

npm install --save upload-to-bunny

Usage

To use the Upload-to-Bunny library, simply import it and call the uploadDirectory function with the appropriate options:

import uploadDirectory from 'upload-to-bunny';

await uploadDirectory(sourceDirectory, destinationDirectory, options);

destinationDirectory accepts both '' and '/' for the storage root. They are equivalent.

Example

import uploadDirectory from 'upload-to-bunny';

// Upload ./dist to the storage root, pruning removed files safely
await uploadDirectory('./dist', '/', {
  storageZoneName: 'your-storage-zone-name',
  accessKey: 'your-bunny-access-key',
  cleanDestination: 'avoid-deletes',
  maxConcurrentUploads: 10,
  region: 'ny',
});

Options

The uploadDirectory function accepts the following options:

  • storageZoneName (string, required): The name of your BunnyCDN storage zone.
  • accessKey (string, required): Your BunnyCDN access key.
  • region (string, optional): Storage region prefix (e.g. ny, la, sg, uk, se, br, jh, syd). If omitted, the default region is used.
  • cleanDestination ("simple" | "avoid-deletes", optional): How to clean the destination before uploading. If omitted, no cleaning occurs.
    • "simple": Deletes the target directory first, then uploads everything. Fastest, but Bunny can misbehave if a file is deleted and then immediately re-uploaded to the same path.
    • "avoid-deletes": Recursively prunes only remote files/folders not present locally and keeps files that are about to be replaced. This works around Bunny's delete-then-reupload issue.
  • maxConcurrentUploads (number, optional): The maximum number of files to upload concurrently. Default is 10.
  • limit (LimitFunction, optional): A custom p-limit instance. If provided, maxConcurrentUploads is ignored.

Named exports

The package also exports uploadFile and deleteFile for lower-level operations:

import { uploadFile, deleteFile } from 'upload-to-bunny';

const options = {
  storageZoneName: 'your-storage-zone-name',
  accessKey: 'your-bunny-access-key',
};

// Upload a single file
await uploadFile('./local/file.txt', '/remote/file.txt', options);

// Delete a remote file
await deleteFile('/remote/old-file.txt', options);

CLI

A CLI is also available for quick uploads:

npx upload-to-bunny --source ./dist --zone my-zone --key my-key

CLI Options

| Flag | Description | Default | Env variable | |------|-------------|---------|--------------| | --source <path> | Local directory to upload | . (current directory) | | | --target <path> | Remote directory path | / | | | --zone <name> | Storage zone name (required) | | BUNNY_STORAGE_ZONE_NAME | | --key <key> | Access key (required) | | BUNNY_ACCESS_KEY | | --region <region> | Storage region (e.g. ny, la, sg) | | BUNNY_STORAGE_REGION | | --clean <mode> | simple or avoid-deletes | avoid-deletes | | | --help | Show help message | | |

CLI Examples

# Upload ./dist using environment variables
export BUNNY_STORAGE_ZONE_NAME=my-zone
export BUNNY_ACCESS_KEY=my-key
npx upload-to-bunny --source ./dist

# Upload to a specific region with simple cleaning
npx upload-to-bunny --source ./dist --zone my-zone --key my-key --region ny --clean simple

# Upload to a subdirectory on the storage zone
npx upload-to-bunny --source ./dist --target /app/assets --zone my-zone --key my-key

Contributing

Contributions are always welcome! If you have any suggestions, bug reports, or feature requests, feel free to open an issue or submit a pull request.