@freqhole/reliquary

中文文档
0.3.27发布于 2026/11/10UNLICENSEDTypeScriptES Module构建来源已验证近 30 天下载 2780

freqhole media blob storage domain: content-addressed blobs, transfer, worker, solid helpers

原始使用文档
文档目录5 节
  1. architecture
  2. structure
  3. rust: getting started
  4. ts: getting started
  5. developer quick start

reliquary

everything media blob storage for the freqhole world of apps: content-addressed blob stores (sqlite-native and indexeddb/opfs-browser), iroh-blobs wrappers (fs store lifecycle, gc protection, verified transfer), the snatch engine (proactive blob replication), the ensure protocol (ask a peer to stage a blob), blob acl gating, media helpers, and shared browser utils. rust crate reliquary + npm package @freqhole/reliquary.

architecture

blake3 is the sole canonical content address everywhere. iroh p2p is a transport, not the architecture - the store contracts and transfer flows are transport-injected. this library never owns an http server: range serving stays in the consuming app.

graph LR
    subgraph app
        A[your app]
    end
    subgraph rust
        B[BlobStore trait<br/>SqliteBlobStore]
        N[StorageNode<br/>iroh-blobs fs store + gc + downloader]
        SN[SnatchEngine<br/>proactive replication]
        EN[ensure protocol<br/>ALPN freqhole/1]
        G[AccessGate<br/>transfer acl seam]
    end
    subgraph browser ts
        TB[./blobs idb records +<br/>opfs/cache bytes]
        TT[./transfer snatch/serve/prefetch]
        TE[./ensure client + responder]
        TW[./worker hashing + opfs io]
    end
    A --> B & N & SN
    SN --> N
    EN --> B
    G -.gates.-> N
    A --> TB & TT & TE
    TT --> TW
    B --- DB[(reliquary.db<br/>own sqlite file)]

structure

rust/               crate: reliquary
  src/
    blobz.rs        BlobStore trait + sqlite impl (blake3 pk, soft delete, derived blobs)
    node.rs         StorageNode: fs store lifecycle, init_local/attach_endpoint, gc protect
    snatch.rs       SnatchEngine over BlobRefSource + PeerProbeTransport traits
    ensure.rs       EnsureBlobHandler + PeerMessage wire types (ALPN "freqhole/1")
    gate.rs         AccessGate seam for the iroh-blobs verified-transfer ALPN
    hash.rs         streaming blake3 helpers
    media/          image resize/webp (feature: media), pdf/video thumbs (feature: thumbnails)
    chunked_import.rs, identity.rs, db.rs
    testing.rs      fixtures (feature: test-utils)
  examples/         runnable walkthroughs (see below)
  migrations/       reliquary.db's own migration set
ts/                 npm: @freqhole/reliquary
  src/{blobs,transfer,ensure,worker,automerge,utils,solid,testing}
docs/               storage-traits.md (the BlobStore contract design)

rust: getting started

use reliquary::{BlobStore, NewBlobMeta};
use reliquary::testing::make_blobz_store;

let (store, _tmp) = make_blobz_store().await;
let record = store.insert(bytes, NewBlobMeta {
    filename: Some("example.txt".into()),
    mime: Some("text/plain".into()),
    ..Default::default()
}).await?;
let bytes_back = store.read_bytes(&record.blake3).await?;

features (all default except thumbnails/test-utils): blobz, node, snatch, ensure, gate, media, chunked_import, identity.

cargo run --example blob-round-trip --features test-utils       # BlobStore contract, no network
cargo run --example blob-acl-gate --features test-utils         # AccessGate over transfer events
cargo run --example snatch-engine --features test-utils         # replication engine w/ mock transport
cargo run --example two-peer-blob-transfer --features test-utils  # real iroh, two endpoints

ts: getting started

framework-free core subpaths; solid-js / @automerge/automerge-repo are optional peer deps used only by ./solid / ./automerge.

subpathwhat
./blobsidb record store + opfs/cache-api bytes, blake3 canonical (createBlobStore)
./transfersnatchBlob/snatchBlobToDisk (pause/resume, per-peer strategy fallthrough), BlobServer, Prefetcher
./ensureensure-blob client + responder over any bi-stream (DEFAULT_ENSURE_ALPN = "freqhole/1")
./workerblob worker (hashing, opfs io, chunked upload) + client facade
./automergeIrohNetworkAdapter + acl change-stripping wrapper
./utilsimage-utils, hash, tagged log
./solidcreateTransferProgress, createBlobUrl, createDocStore (optional)
./testingmock streams/nodes, wav + deterministic-bytes fixtures, idb harness
import { createBlobStore } from "@freqhole/reliquary/blobs";
const store = createBlobStore({
  dbName: "myapp-blobs",
  allowCacheFallback: false,
});

vite consumers: worker-bundled midden resolution needs a resolveId plugin in BOTH plugins and worker.plugins (see skein/loam's vite.config.ts) - a plain resolve.alias silently fails at runtime only.

developer quick start

# rust (no DATABASE_URL needed - queries are runtime-checked)
cargo test --workspace --all-features
cargo fmt --all --check && cargo clippy --workspace --all-targets

# ts
cd ts && npm i
npm run typecheck && npm test && npm run build

the crate owns its own sqlite db (reliquary.db) at runtime, separate from any consuming app's db. consumers today: skein (hub daemon + tauri + loam, full cutover), tomb/grimoire (hash; storage seam in progress), playlistz (transfer/blobs adoption planned).

see docs/storage-traits.md for the BlobStore contract design; the canonical refactor plan lives in tomb/docs/xl-refactor/.

版本与发布记录

@freqhole/reliquary 共发布 43 个版本,首次发布于 2026/07/22;过去 12 个月发布了 43 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.3.27latest2026/11/105 天前
0.3.262026/11/078 天前
0.3.252026/11/0510 天前
0.3.242026/11/0510 天前
0.3.232026/11/0313 天前
0.3.222026/10/2818 天前

关于 @freqhole/reliquary 的常见问题

@freqhole/reliquary 是什么?

freqhole media blob storage domain: content-addressed blobs, transfer, worker, solid helpers

如何安装 @freqhole/reliquary?

在项目目录运行 npm install @freqhole/reliquary,或使用 pnpm add / yarn add / bun add。

@freqhole/reliquary 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@freqhole/reliquary 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@freqhole/reliquary 可以商用吗?

@freqhole/reliquary 使用 UNLICENSED 许可。作者声明为 UNLICENSED,即不授予公开使用许可(与公共领域的 Unlicense 不同)。使用前需获得作者授权。以上为概括,不构成法律意见,请以许可原文为准。

@freqhole/reliquary 的下载量有多少?

根据 npm 官方下载统计,@freqhole/reliquary 在 2026/10/16 – 2026/11/14 这 30 天内被下载 2,780 次,日均约 93 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@freqhole/reliquary 还在维护吗?

最新版本 0.3.27 发布于 2026/11/10(5 天前);至今共发布 43 个版本,其中过去 12 个月发布了 43 个;首次发布于 2026/07/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。