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

@emdzej/bimmerz-vfs

v0.2.0

Published

Read-only virtual file system abstraction for bimmerz tools — same interface over local File System Access API, remote HTTP index.json trees, and an OPFS / IndexedDB cache layer for the HTTP backend.

Downloads

314

Readme

@emdzej/bimmerz-vfs

Read-only virtual file system for bimmerz tools — one interface, two backends:

| Backend | Class | Source | |---|---|---| | Local | FsaDirectory | File System Access API / OPFS (FileSystemDirectoryHandle) | | Remote | HttpDirectory | HTTP server + index.json directory listings |

Both implement VirtualDirectory. All lookups are case-insensitive.

Install

npm i @emdzej/bimmerz-vfs

Quick start

import { FsaDirectory, HttpDirectory, drillPath, listFiles } from '@emdzej/bimmerz-vfs';

// ---- Local (File System Access API / OPFS) ----
const handle = await showDirectoryPicker();
const local = new FsaDirectory(handle);

// ---- Remote (HTTP + index.json) ----
const remote = new HttpDirectory('https://files.example.com/inpa-bundle');

// ---- Same API for both ----
const ecu = await drillPath(remote, 'EDIABAS', 'Ecu');   // case-insensitive
const ipos = await listFiles(ecu!, '.ipo');               // [{ name: 'MS43.IPO', size: 12345 }]
const file = await ecu!.file('ms43.prg');                 // case-insensitive
const bytes = await file!.arrayBuffer();

API

VirtualDirectory

interface VirtualDirectory {
  readonly name: string;

  /** Case-insensitive. Returns null if not found. */
  file(name: string): Promise<VirtualFile | null>;

  /** Case-insensitive. Returns null if not found. */
  dir(name: string): Promise<VirtualDirectory | null>;

  /**
   * Flat listing of direct children.
   * Note: FsaDirectory returns size=0 for files — call file(name) for the real size.
   */
  entries(): Promise<VirtualEntry[]>;
}

type VirtualEntry =
  | { kind: 'file'; name: string; size: number }
  | { kind: 'dir';  name: string };

VirtualFile

interface VirtualFile {
  readonly name: string;   // original-cased full basename: "MS43.IPO"
  readonly size: number;
  arrayBuffer(): Promise<ArrayBuffer>;
}

FsaDirectory(handle)

Wraps a FileSystemDirectoryHandle (File System Access API or OPFS). Both sources return the same handle type, so this class works for both.

// File System Access API (user picks a folder)
const root = new FsaDirectory(await showDirectoryPicker());

// OPFS (pre-extracted bundle)
const opfsRoot = await navigator.storage.getDirectory();
const root = new FsaDirectory(opfsRoot);

entries() does not call getFile() per entry (no extra I/O for listings). Call file(name) when you need the actual size.

HttpDirectory(baseUrl, options?)

Navigates a remote tree using index.json files generated by bimmerz data index.

const root = new HttpDirectory('https://cdn.example.com/inpa', {
  indexFile: 'index.json',  // default
  fetch: customFetch,       // inject auth headers, mock in tests, etc.
});

How it works:

  1. On first access entries() / file() / dir() fetches {baseUrl}/index.json and caches it.
  2. file(name) finds the matching entry (case-insensitive on fullName) and returns an HttpFile that fetches {baseUrl}/{originalFullName} on arrayBuffer().
  3. dir(name) returns a new HttpDirectory rooted at {baseUrl}/{originalFullName}/, which lazily fetches its own index.json.

The index.json format is the one written by bimmerz data index — both fullName (lowercase) and originalFullName (original casing) are present in every entry. The lookup uses fullName for matching and originalFullName for the fetch URL, so the original casing of the server's files is preserved in HTTP requests.

link entries (symlinks recorded by bimmerz data index) are treated as files.

drillPath(root, ...segments)

Walk down a path segment by segment, case-insensitively. Returns null at the first missing segment.

const cfgdat = await drillPath(root, 'EC-APPS', 'INPA', 'CFGDAT');
// equivalent to:
// root.dir('EC-APPS') → .dir('INPA') → .dir('CFGDAT')

listFiles(dir, ext?)

Return all file entries in dir, optionally filtered by extension (case-insensitive, dot required).

const ipos = await listFiles(cfgdat, '.ipo');
// [{ kind: 'file', name: 'MS43.IPO', size: 512 }, ...]

Returns Array<{ kind: 'file'; name: string; size: number }> — lightweight entry objects. Call dir.file(name) to open one.

Serving an install remotely

Use bimmerz data index to write index.json files into the extracted install tree, then serve the whole directory over HTTP (nginx, GitHub Pages, any static host):

bimmerz data index ~/inpa-extracted
# → writes index.json in every subdirectory

# Serve with any static file server
npx serve ~/inpa-extracted

Then point HttpDirectory at the server root:

const root = new HttpDirectory('http://localhost:3000');
const cfgdat = await drillPath(root, 'EC-APPS', 'INPA', 'CFGDAT');
const ipo = await cfgdat!.file('MS43.IPO');
const bytes = await ipo!.arrayBuffer();

Notes

  • Read-only — no write operations. External write-back (fault-store reports, etc.) is application-layer concern.
  • No runtime dependencies — FSA is a browser built-in; HTTP uses fetch. Works in any environment with fetch (browsers, Node ≥ 18, Deno, Bun).
  • Index caching — each HttpDirectory instance fetches its index.json at most once. Create a new instance to force a refresh.