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

@alwith/module-fs

v0.6.2

Published

A transport-independent filesystem contract and operation coordinator. The core has no React, DOM or Tauri dependency. Adapters enforce permissions; JavaScript capabilities only describe the UI's available actions.

Downloads

2,320

Readme

@alwith/module-fs

A transport-independent filesystem contract and operation coordinator. The core has no React, DOM or Tauri dependency. Adapters enforce permissions; JavaScript capabilities only describe the UI's available actions.

Use

import { createFileSystem } from "@alwith/module-fs"
import { createMemoryAdapter } from "@alwith/module-fs/testing"
const fs = createFileSystem({
  adapter: createMemoryAdapter({ "/project/readme.md": "# Hello" }),
  reportError: error => console.error(error)
})
const stop = fs.subscribe(event => console.log(event))
await fs.writeFile("/project/readme.md", new TextEncoder().encode("# Changed"), { mode: "replace" })
stop()

Contract

  • FsAdapter implements stat, byte reads/writes, directory listing, mkdir, move, copy and remove. stat returns null only for an absent path; all other errors propagate.
  • WriteOptions.mode distinguishes create-only, replace-existing and upsert. expectedVersion rejects stale saves. Adapters must enforce both, not treat them as advisory.
  • createFileSystem serializes mutations and transaction calls in one instance. A transaction receives a non-queuing writer; never call the outer service's mutation methods from inside a transaction or guard.
  • beforeMutation can cancel move/remove/copy/mkdir. Editor controllers use it to protect unsaved deleted documents. A cancellation rejects with MutationCancelledError. A guard may return { allow, release } to hold an operation lease until commit/failure; releases always run and cannot change the disk result.
  • subscribe reports committed operations. Native/watch observations have a separate source: "watch"; they are invalidations, not proof a particular UI operation committed. reportError must not throw.
  • watch is optional. Hosts own and release the returned subscription. No polling or network access is started by importing the package.
  • Path helpers understand POSIX, Windows drive and UNC roots. joinPath accepts a single filename and rejects traversal. Helpers are lexical; adapters still must enforce canonical/symlink boundaries. Path identity is case-sensitive; native adapters must provide consistent canonical identities.

Native distribution

Native access is the Tauri plugin alwith-fs (crates.io); the implementation is a private library shipped in this package under native/, staged by the application.

.plugin(alwith_fs::init(alwith_fs::Config { development_directory, ..Default::default() }))

Grant alwith-fs:default (open, list, stat, read, watch) and, as needed, alwith-fs:workspace-write, alwith-fs:patches, alwith-fs:git (branch, file statuses, upstream sync summary, recent commits and changed files of an opened workspace, read with gix in the library, no system git), alwith-fs:exec (workspace_exec_bash: run a typed shell command in an opened workspace with the user's login shell, killed after five minutes; not sandboxed) and alwith-fs:capability in src-tauri/capabilities/*.json. @alwith/module-fs/commands holds the generated typed commands and the workspace:change event; @alwith/module-fs/tauri builds an FsAdapter over them from a root returned by commands.workspaceOpen.

Applications that synchronize files pass a Coordinator in Config: every mutation, with its canonical write and removed paths, runs inside it one at a time; reads never wait. Rust code uses FileSystem, watch, validate_patch_path, apply_patches, the Git readers current_branch, file_statuses, sync_status, recent_commits and changed_files (blocking) and exec_bash (async), which also work without a webview after alwith_native_client::configure_host or ALWITH_NATIVE_DIRECTORY, and shares authorization and ordering through app.state::<Workspace>() (open, root, lock).

The library limits reads/writes to 16 MiB, preserves binary bytes, checks versions, uses same-directory temporary writes, rejects root mutation and mutation of terminal symbolic links, and refuses existing copy/move destinations. A recursive copy is staged before exposing the destination. Patches are validated in full (paths, symlinks, .git, hunks, size) before the first change and applied with Git without touching the index. Version checks do not provide an OS-wide transaction against arbitrary external writers. Watch errors are reported explicitly.

Develop

From the repository root: bun run --cwd packages/fs build and bun test packages/fs/src; in rust/, cargo test (bindings current; UPDATE_BINDINGS=1 regenerates them) and, with the library built, ALWITH_NATIVE_DIRECTORY=<target/debug> cargo test -- --ignored. Publish authorization is separate.