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

@bunny.net/storage-sdk

v0.3.1

Published

---

Downloads

15,487

Readme

@bunny.net/storage-sdk


The @bunny.net/storage-sdk a library designed to help you interact with BunnyCDN Storage API.

Bunny Storage SDK

This repository contains @bunny.net/storage-sdk, a library designed to simplify the usage of the BunnyCDN Storage API.

🥕 Usage

With @bunny.net/storage-sdk, you can interact with the BunnyCDN Storage API. Below is a quick example to help you get started with setting up a local server. For additional examples and use cases, refer to the examples folder.

Listing files on your Storage Zone

import * as BunnySDK from "@bunny.net/edgescript-sdk";
import * as BunnyStorageSDK from "@bunny.net/storage-sdk";

let sz_zone = process.env.STORAGE_ZONE!;
let access_key = process.env.STORAGE_ACCESS_KEY!;

let sz = BunnyStorageSDK.zone.connect_with_accesskey(BunnyStorageSDK.regions.StorageRegion.Falkenstein, sz_zone, access_key);

console.log("Starting server...");

BunnySDK.net.http.serve({ port: 8080, hostname: '127.0.0.1' }, async (req) => {
  let list = await BunnyStorageSDK.file.list(sz, "/");
  console.log(`[INFO]: ${req.method} - ${req.url}`);
  return new Response(JSON.stringify(list));
});

This example sets up a local HTTP server using the Bunny Edge Scripting SDK to list files on a Storage Zone using the BunnyCDN Storage SDK. You can access the server at 127.0.0.1:8080 and observe the real-time request logs.

Quick Start

Getting a file

When getting a file, you can either get the metadata of a file, or the content of the file.

The metadata describe the file.

import * as BunnyStorageSDK from "@bunny.net/storage-sdk";

let storageZone = BunnyStorageSDK.zone.connect_with_accesskey(BunnyStorageSDK.regions.StorageRegion.Falkenstein, "storage-zone-name", "token")
let obj = await BunnyStorageSDK.file.get(storageZone, "/my-folder/my-file");

/*
 * Here obj will be equal to something like this:
const obj = {
    Guid: '123',
    UserId: 'user1',
    LastChanged: '2023-01-01T00:00:00Z',
    DateCreated: '2022-01-01T00:00:00Z',
    StorageZoneName: 'test-zone',
    Path: '/test/path',
    ObjectName: 'test-file.txt',
    Length: 100,
    StorageZoneId: 1,
    IsDirectory: false,
    ServerId: 1,
    Checksum: 'abc123',
    ReplicatedZones: 'UK,NY',
    ContentType: 'text/plain',
    data: () => Promise<{
      stream: ReadableStream<Uint8Array>;
      response: Response;
      length?: number;
    }>,

};
*/

From this metadata, you can then download the file content by using await obj.data().

Listing files

You can list and navigate accross your storage zone by using:

let list = await BunnyStorageSDK.file.list(sz, "/");

This will give you a list of file Metadata you'll be able to navigate.

Uploading a file

To upload a file, we leverage Streams to upload files as it would allow you to upload files without having the full stream of content available.

export async function upload(storageZone: StorageZone.StorageZone, path: string, stream: ReadableStream<Uint8Array>, options?: UploadOptions): Promise<boolean>;
export async function upload(storageZone: StorageZone.StorageZone, path: string, stream: ReadableStream<Uint8Array>): Promise<boolean>;
export async function upload(storageZone: StorageZone.StorageZone, path: string, stream: ReadableStream<Uint8Array>, options?: UploadOptions): Promise<boolean>;

export type UploadOptions = {
  /**
   * The SHA256 Checksum associated to the data you want to send. If null then
   * the server will automatically calculate it.
   */
  sha256Checksum?: string;
  /**
   * You can override the content-type of the file you upload with this option.
   */
  contentType?: string;
};

Example:

await BunnyStorageSDK.file.upload(sz, "/some-file", random_bytes_10kb);

Download a file

To downlaod a file, you have two choices, either you use this function to download it directly.

export async function download(storageZone: StorageZone.StorageZone, path: string): Promise<{
  stream: ReadableStream<Uint8Array>;
  response: Response;
  length?: number;
}>;

Example:

await BunnyStorageSDK.file.download(sz, "/some-file");

You'll have the stream of the content and the associated response and the length if available.

You could also use the data function available in the File Metadata.

Remove files or directory

export async function remove(storageZone: StorageZone.StorageZone, path: string): Promise<boolean>;
export async function removeDirectory(storageZone: StorageZone.StorageZone, path: string): Promise<boolean>;

Example:

await BunnyStorageSDK.file.remove(sz, "/some-file");