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

@lankajs/blob-cache

v1.0.2

Published

module: IndexedDB → Cache Storage → memory → direct fetch, with a memory budget and quota eviction.

Readme

@lankajs/blob-cache

▸ module · Binary resource cache

IndexedDB → Cache Storage → memory → direct fetch, with a memory budget and quota eviction.

A library in the same box. The app imports and calls it; core does not know it exists.

Runs in: the browser.

How to use it: GUIDE.md — the user guide, with examples. How to change it: SKILL.md.

Contents

  • LankaBlobCacheStore — the IndexedDB → Cache Storage → memory chain, memory budget, quota eviction
  • LankaBlobCachePolicy — resolution without an <img> src swap, warm-up queue, fallbacks
  • setupLankaBlobCacheLifecycle — session-end cleanup and object-URL revocation on page hide
  • LankaCacheStorageBlobAdapter — the second rung of the chain

What the application must declare

The package caches bytes and refuses to guess whose. Four decisions have no default that could be right, so each is configuration and each is empty until an application fills it — spread LANKA_BLOB_CACHE_CONFIG and override what you know:

| Decision | Default | Why there is no better default | | --- | --- | --- | | corsBlockedOrigins | [] | a host whose CORS forbids reading the bytes can never be cached, and trying anyway costs a request per render. Which hosts those are is a property of your infrastructure | | sameOriginProxy | null | rewriting a third-party URL through your own origin makes it cacheable. Whether you HAVE such a proxy, and at what path, the package cannot know | | acceptContentType | images | a predicate, not a hard-coded image/: an app caching PDFs or fonts changes one function instead of forking the store | | session end | passed in | setupLankaBlobCacheLifecycle({ cache, subscribeToSessionEnd }) takes both as parameters. What ENDS a session — a sign-out, a token expiry, a tab closing — is the application's answer, and a module that reached for a locator to find it would stop working without the framework |

The sizes and lifetimes (maxTotalBytes, maxEntryBytes, maxMemoryBytes, ttlMs, evictionRatio, hydrateLimit, maxConcurrent) do have defaults that are right for a phone, and are worth revisiting only with a measurement.

Safe for content-addressed URLs, and only those

The cache never revalidates: a key carrying a uuid or a hash cannot go stale, so there is nothing to check. Point it at a URL whose CONTENT can change under the same name and it will serve the old bytes until the entry expires — which is not a bug to be fixed but the property that makes the whole thing cheap.


Repository map: ../../README.md