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

@mnemosyne_os/affine-reader

v0.1.8

Published

Read a local AFFiNE workspace (SQLite + Yjs) and render its documents to Markdown. No BlockSuite at runtime, no native module, read-only.

Readme

@mnemosyne_os/affine-reader: Read a local AFFiNE workspace (SQLite + Yjs) and render its documents to Markdown. No BlockSuite at runtime, no native module, read-only.

Product mnemosyne-os.io · Company, press and labs mnemosyne-os.com · Documentation docs.mnemosyne-os.io

@mnemosyne_os/affine-reader

Read a local AFFiNE workspace and render its documents to Markdown. AFFiNE does not need to run. No BlockSuite, no server.

Read-only, in every direction. Two processes writing one CRDT corrupt it. This package copies the database before it reads, and never writes back.

Quick start: one command

npx @mnemosyne_os/affine-reader ./out

This writes one Markdown file per document, plus its images, for every AFFiNE workspace on this machine. It needs Node 22.13+ or 23.4+ (see Bring your own SQLite).

Install

npm install @mnemosyne_os/affine-reader

Runtime dependency: yjs. That is the whole list.

Use

import {
  affineDataDir,
  exportWorkspace,
  findWorkspaces,
  openNodeSqlite,
  stageDatabase,
} from '@mnemosyne_os/affine-reader';
import { mkdtempSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';

for (const ref of findWorkspaces()) {
  const staged = stageDatabase(ref.dbPath, mkdtempSync(join(tmpdir(), 'affine-')));
  const db = openNodeSqlite(staged.path);
  try {
    const result = exportWorkspace(db, `./out/${ref.id}`);
    console.log(result.files, result.skipped);
  } finally {
    db.close();
    staged.dispose();
  }
}

findWorkspaces() returning [] and affineDataDir() returning null are different answers. The first says there is nothing to read. The second says AFFiNE is not installed. Both are reported.

Bring your own SQLite

openNodeSqlite uses Node's built-in node:sqlite. It runs without a flag from Node 22.13 and 23.4 onward, and exists from 22.5 behind --experimental-sqlite. Electron 31 ships Node 20 and has none, so a host passes its own adapter:

import Database from 'better-sqlite3';
import { readWorkspace } from '@mnemosyne_os/affine-reader';

const raw = new Database(stagedPath);
readWorkspace({ prepare: (sql) => raw.prepare(sql), close: () => raw.close() });

What it reads

| | | |---|---| | Location | <app-data>/AFFiNE*/<workspaces\|userspaces>/<peer>/<id>/storage.db | | Channels | Every one you have installed. AFFiNE names the folder AFFiNE for a stable release, and AFFiNE-canary, AFFiNE-beta or AFFiNE-internal otherwise. Most of their releases are canary | | Schema | nbstore v2 (snapshots + updates + blobs), and the legacy v1 shape | | Content | Yjs history replayed into a document, rendered by AFFiNE's own MIT parser |

Headings, lists, checkboxes, bold and italic, links, code, tables, database views, LaTeX and images all survive the trip. Images come out as blob files, with links that point at them.

Two things that will bite you

The content may live in the -wal, not in storage.db. Measured on one running 0.27.4 install: at 14:28, storage.db was 4 KB next to a 1.8 MB -wal. At 14:46, same app still running, the journal had been checkpointed away and storage.db was 1.14 MB with no sidecar at all. A reader that copies only storage.db sees an empty workspace in the first state and cannot tell. stageDatabase() copies the sidecars when they exist and reports which ones it took.

A snapshot alone is stale. A document typed one minute earlier decoded to 2 characters from its snapshot row, and to 323 once its 16 updates rows were replayed. Older documents give the same answer either way. A test written on those passes while the reader loses everything the user just wrote. Every load here replays the updates.


Your AFFiNE notes, searchable in Mnemosyne OS

This package was built for Mnemosyne OS, a memory system that runs on your own machine. Its desktop app uses this reader to bring an AFFiNE workspace into memory:

  1. Open Settings › Vaults › Import from AFFiNE.
  2. Choose a folder. Each document becomes one Markdown file, with its images.
  3. Point a vault at that folder. You can then ask the chat about your notes, or reach them from Claude, Cursor or any MCP agent through @mnemosyne_os/mcp.

AFFiNE itself is only read, never written to. Run the import again after you edit: renamed, deleted or trashed documents leave the folder too.

⬇ Download Mnemosyne OS

Free download for Windows, macOS and Linux


The @mnemosyne_os packages

All of them live under one npm organization: npmjs.com/org/mnemosyne_os

| Package | What it is | |---|---| | @mnemosyne_os/sdk | Build a Layer 2 app: a Node or browser process talking to the local WebSocket surface | | @mnemosyne_os/create-app | npm create @mnemosyne_os/app scaffolds that Layer 2 app in one command | | @mnemosyne_os/cartridge-sdk | Build an in-app cartridge: a sandboxed iframe widget rendered on the canvas | | @mnemosyne_os/mcp | MCP server: plug Claude, Cursor or any MCP agent into the vaults | | @mnemosyne_os/design-sdk | Skin the OS with JSON alone, no TypeScript | | @mnemosyne_os/public-contracts | The shared types and Zod schemas. No business logic | | @mnemosyne_os/agent-transcripts | Read what coding agents already write on disk: the connector format and the interpreter | | @mnemosyne_os/affine-reader (you are here) | Read a local AFFiNE workspace and render its documents to Markdown | | @mnemosyne_os/forge | CLI: scaffold, list chronicles, import and export | | @mnemosyne_os/sync | The name of the P2P layer to come. A placeholder today, not the library |

Where Mnemosyne OS lives

Published by XPACEGEMS LLC. Its official addresses:


Licence

MIT © Tony Trochet / XPACEGEMS LLC. Includes MIT-licensed source vendored from AFFiNE, see NOTICE.md. BlockSuite (MPL-2.0) is not included and is not required at runtime.