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

@bytecask/core

v2026.7.4

Published

Browser-native content-addressed binary blob store — BLAKE3 addressing, tiered storage adapters (OPFS via worker, IndexedDB, memory), dedup, refcount, GC.

Downloads

242

Readme

@bytecask/core

Browser-native, content-addressed blob storage.

Store binary data in IndexedDB, OPFS, or memory behind one typed API with BLAKE3 addressing, deduplication, lifecycle accounting, and recovery tools.

pnpm add @bytecask/core

npm downloads license TypeScript

Quick Start · Backends · API · Browser Support · Documentation


What It Is

@bytecask/core is the framework-neutral Bytecask storage engine. It accepts Blob, Uint8Array, or streamed bytes and returns a lowercase BLAKE3 content hash. Identical content is stored once, while lifecycle metadata determines whether the object is live, collectible, or missing.

| It provides | It deliberately leaves to the host | |---|---| | Content-addressed binary storage | Records and relational data | | IndexedDB, OPFS, and memory adapters | User authorization and synchronization | | Deduplication, references, GC, reconciliation | Signing and publisher identity | | Quota and integrity errors | The only copy of irreplaceable data | | Portable blobs/<hash> packing | Product-specific attachment workflows |

Highlights

  • BLAKE3 content identity: stable hashes support deduplication and portable manifests.
  • IndexedDB-first persistence: broad cross-browser storage without a database dependency.
  • Optional OPFS streaming: worker-backed large-file I/O is loaded only when selected.
  • Explicit lifecycle models: use refcounts or reconcile against a canonical host manifest.
  • Failure-aware writes: partial objects are removed after quota, metadata, integrity, or streaming failures.
  • ESM and TypeScript: typed public exports with no top-level browser-global access, so importing during SSR is safe.

Installation

Install the core package for IndexedDB, memory, and automatic backend selection:

pnpm add @bytecask/core

Add the worker package only when using OPFS:

pnpm add @bytecask/core @bytecask/worker

Quick Start

import { createBlobStore } from '@bytecask/core'

const store = await createBlobStore({ backend: 'idb' })
const hash = await store.put(new Blob(['hello, Bytecask']))

console.log(hash) // lowercase BLAKE3 hex

const blob = await store.getBlob(hash)
const bytes = await store.get(hash)

await store.close()

Automatic selection tries IndexedDB, then OPFS, then memory and exposes the result as store.backend. Force a persistent backend for archives that must never degrade to session memory.

Storage Backends

| Backend | Selection | Persistence | Best fit | |---|---|---|---| | IndexedDB | Default persistent tier | Browser-managed, evictable | General files and attachments | | OPFS | Explicit or automatic fallback | Browser-managed, evictable | Streaming and large binary objects | | Memory | Explicit or final fallback | Session only | Tests, previews, and ephemeral data |

const store = await createBlobStore({
  backend: 'idb',
  idb: { databaseName: 'archive-blobs' },
  metadata: { databaseName: 'archive-metadata' },
  verifyOnRead: true,
})

const persistenceGranted = await store.requestPersistence()
const report = await store.reconcile(liveAttachmentHashes)

A forced backend rejects when unavailable. It never silently changes the requested durability model.

Lifecycle Models

Choose one authority per store:

  1. Store-managed: put() creates a reference; balance ownership with ref() and unref(), then collect with gc().
  2. Host-managed: retain hashes in a canonical manifest and call reconcile(liveHashes) to repair metadata and identify missing or unreferenced bytes.

Do not maintain independent refcount systems for the same archive.

Main API

| Export | Purpose | |---|---| | createBlobStore(options) | Select or force a storage backend | | put, get, getBlob, has, delete | Store and retrieve bytes by hash | | ref, unref, gc | Store-managed lifecycle accounting | | reconcile(liveHashes) | Repair state from a host-authoritative manifest | | estimate, requestPersistence | Observe browser storage and persistence | | packBlobs, unpackBlobs | Move portable blobs/<hash> entries | | BytecaskError, QuotaError, IntegrityError | Handle typed storage failures |

Browser Support

  • IndexedDB behavior is tested in Chromium, Firefox, and Playwright WebKit.
  • OPFS worker behavior is tested in Chromium and Firefox.
  • Memory storage works in browser and JavaScript test environments.
  • The package is ESM-only and targets modern browsers.

Playwright WebKit is an engine proxy, not Apple's shipping Safari binary. Treat browser storage as a rebuildable local copy because persistence requests reduce eviction risk but cannot eliminate it.

Related Packages

| Package | Purpose | |---|---| | @bytecask/worker | Optional OPFS worker and streaming I/O | | @bytecask/react | Optional React provider and hooks |

Documentation

Security

Bytecask verifies content identity, not publisher identity. Verify signed containers or shards before hydrating untrusted bytes. Report vulnerabilities through the project's security policy, not a public issue.

License

AGPL-3.0-only. See LICENSE.