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

github-cdn-sdk

v1.0.1

Published

Atomic decentralized asset CDN SDK for GitHub infrastructure.

Readme

GithubCDN SDK 🚀

NPM Version License: MIT

A professional, zero-cost TypeScript SDK for decentralized asset delivery. Use GitHub as your storage backend and jsDelivr/Cloudflare as your global edge network.

why use this?

  • Zero Hosting Fees: Leverages GitHub's free storage and jsDelivr's free global CDN.
  • Edge Native: Works in Node.js, Vercel Edge, and Cloudflare Workers/Pages.

📊 Performance Comparison

| Metric | Without Cloudflare | With Cloudflare Edge | |:---|:---|:---| | Large Asset (350MB) | 180s - 300s+ | 0.7s (Edge Cached) | | Medium Asset (50MB) | 25s - 45s | 0.1s (Edge Cached) | | TTFB | 800ms–1500ms | 15ms–40ms | | Scalability | 5K req/hr | Unlimited (cached) | | Cost | $0 | $0 |

Real-world Benchmarks: Using Cloudflare edge caching, a 350MB file is delivered in just 0.7s, while a standard GitHub fetch for a 50MB file can take over 25s.

  • Atomic Commits: Uses the GitHub Git API to ensure asset uploads and registry updates are atomic.
  • Micro-Chunking: Automatically splits large files to bypass GitHub's file size limits and optimize streaming.

📦 Installation

npm install github-cdn-sdk

🚀 Quick Start

1. Initialize the Client

import { GithubCDN } from "github-cdn-sdk";

const cdn = new GithubCDN({
  token: process.env.GITHUB_TOKEN, // Fine-grained PAT with 'Contents' Read/Write
  owner: "your-username",
  repo: "assets-storage",
  branch: "main" // Optional, defaults to main
});

2. Upload with Progress

const file = ...; // File, Blob, or Node.js Buffer
const asset = await cdn.upload(file, (log) => {
  if (log.progress) {
    console.log(`Upload progress: ${log.progress.percentage}%`);
  }
});

console.log("Live URL:", asset.links.cdn);

3. Fetch & Stream (Cloudflare Native)

The fetch method is optimized for Cloudflare Workers. It races between multiple sources to ensure the fastest possible TTFB.

const { stream, manifest } = await cdn.fetch(asset.path);

return new Response(stream, {
  headers: {
    "Content-Type": manifest.mimeType,
    "Cache-Control": "public, max-age=31536000, immutable"
  }
});

🛠️ API Reference

cdn.upload(input, onUpdate?)

Uploads a binary file. Supports automatic chunking (5MB chunks).

  • input: File | Blob | Buffer
  • onUpdate: Callback for progress tracking.

cdn.fetch(assetPath, onUpdate?)

Retrieves an asset as a ReadableStream.

cdn.delete(id, folderPath)

Performs a permanent physical scrub, removing the asset and its history from the repository.

cdn.list()

Lists all assets currently tracked in the registry.json.

cdn.sync()

Deep-scans the repository to recover lost or corrupted registry metadata.

cdn.ping()

Utility to verify if your GitHub Token and Repository permissions are correctly configured.


🛡️ Security Best Practices

  • Token Scope: Use a GitHub Fine-grained Personal Access Token restricted only to the specific CDN repository.
  • Secrets Management: Never commit your GITHUB_TOKEN to version control. Use Environment Variables in GitHub Actions or Cloudflare Pages.

📜 License

MIT © CodeFaisalDev