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

sushi-fetch

v1.0.0

Published

🍣 A tiny but powerful data-fetching & caching library for modern JavaScript & TypeScript apps

Readme

🍣 sushi-fetch

The lightweight, reactive powerhouse for modern data fetching.

NPM Version Bundle Size Downloads Stars

Explore Docs β€’ Report Bug β€’ Request Feature


πŸš€ The v1.0.0 Evolution

Modern web apps need more than just fetch(). They need to survive poor networks, deduplicate aggressive UI renders, and keep data fresh automatically. Usually, you'd have to choose between "too barebones" (native fetch) or "too heavy" (GraphQL clients/TanStack).

sushi-fetch v1.0.0 is the "Sweet Spot". We bring Silicon Valley-grade data synchronization to a ridiculously small footprint.

✨ The "Secret Sauce" (Features)

  • 🚦 [NEW] Smart Batching (Event Loop Deduplication): Prevents network spam. 10 identical requests in the same tick? Only 1 hits the server.
  • πŸ’Ύ [NEW] Offline Persistence: Automatically dumps cache to localStorage (or custom adapters) and hydrates instantly on reload.
  • πŸ“‘ [NEW] Auto-Polling & Focus Revalidation: Keeps your UI feeling "alive". Data refetches automatically when the user switches tabs or on a set interval.
  • 🧠 Smart Memory Cache: Built-in TTL, sliding expiration, and LRU eviction.
  • πŸ”„ SWR (Stale-While-Revalidate): Instant UI updates with background synchronization.
  • ⚑ Reactive Pub/Sub: Real-time state sync across your entire UI without needing Redux or Pinia.
  • πŸ“ˆ Native Streaming: Simple progress tracking for big uploads/downloads.
  • πŸ” Smart Retries: Fixed or Exponential Backoff strategies out of the box.
  • πŸͺΆ Zero Dependencies: Pure, tree-shakable, strongly-typed TypeScript.

πŸ“¦ Installation

npm install sushi-fetch  # or pnpm, yarn, bun

πŸ›  The Magic (Quick Starts)

1. The "Indestructible" Request (v1.0.0)

Combine our most powerful features in a single, elegant call.

import { sushi } from 'sushi-fetch';

const data = await sushi.get('/api/dashboard', {
  batch: true,              // Groups simultaneous calls into one network request
  revalidateOnFocus: true,  // Silently updates data when user returns to the tab
  pollInterval: 10000       // Keeps data fresh every 10 seconds
});

2. Offline Persistence (Zero-Config Hydration)

Keep your app working even when the signal drops. sushi-fetch handles the storage and hydration automatically.

import { SushiCache } from 'sushi-fetch';

// Setup persistent cache (Uses localStorage by default in browsers)
const persistentCache = new SushiCache({ 
  persistKey: 'my-app-offline-db' 
});

// Next time the user opens the app, data loads from disk in 0ms!

3. The Power of SWR (Stale-While-Revalidate)

Show the old data immediately, fetch the new one in the background. Your UI feels 10x faster.

const { data } = await sushi.get('/api/stats', { revalidate: true });

4. Real-time Progress (Streaming)

Tracking download/upload progress without messing with raw Streams.

await sushi.get('/api/large-file', {
  onProgress: ({ percentage }) => console.log(`Downloading: ${percentage}%`),
});

πŸ“Š Comparison: No Bloat, Just Speed

| Feature | Native Fetch | Axios | Sushi-Fetch | | :--- | :--- | :--- | :--- | | Size (Gzip)| ~0kB | ~5.5kB | ~3.5kB | | Caching | ❌ | ❌ | βœ… (Built-in) | | Smart Batching | ❌ | ❌ | βœ… (Auto) | | Offline Sync | ❌ | ❌ | βœ… | | SWR | ❌ | ❌ | βœ… | | Revalidation | ❌ | ❌ | βœ… (On Focus / Interval) | | Streaming | ❌ (Hard) | ❌ | βœ… (Simple) |


βš™οΈ Advanced: Global Instance & Interceptors

Create a pre-configured instance for your specific API, complete with middleware and auth interception.

import { createSushi } from 'sushi-fetch';

const api = createSushi({
  baseUrl: '[https://api.myapp.com/v1](https://api.myapp.com/v1)',
  interceptors: {
    request: async (url, options) => {
      options.token = getMySecretToken(); // Automatically attaches Bearer token
      return options;
    }
  }
});

// Usage anywhere in your app:
const user = await api.get('/profile');

🀝 Support the Movement

This project is a labor of love for efficient, high-performance code. If sushi-fetch helped you build a faster app, please consider:

  • Giving it a Star ⭐ (It helps others find the library!)
  • Submitting an Issue if you find a bug.
  • Sharing it on Twitter/X or LinkedIn.

πŸ“„ License

MIT Β© sushilibdev