Skip to content

Commit 620442d

Browse files
committed
Document DurableObjectRawFileSystem and snapshot helper
Update package docs to reflect a third concrete filesystem implementation: DurableObjectRawFileSystem — a thin DO KV-backed filesystem that commits every write synchronously for per-write durability. Add documentation for createFileSystemSnapshot which builds an InMemoryFileSystem from sync or async iterables of [path, content], enabling bridging async storage backends to the synchronous FileSystem interface. Also clarify an internal comment in file-system.ts to state the write-overlay is not re-exported from the package entry point.
1 parent 70da49d commit 620442d

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.changeset/worker-bundler-filesystem.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ back the virtual filesystem with persistent or custom storage — for example, a
1010
`DurableObjectKVFileSystem` that buffers writes in memory and flushes to Durable
1111
Object KV on demand, avoiding a KV write for every individual file operation.
1212

13-
Two concrete implementations are exported from the package:
13+
Three concrete implementations are exported from the package:
1414

1515
- `InMemoryFileSystem` — a `Map`-backed filesystem suitable for tests and
1616
in-process pipelines. Accepts an optional seed object or `Map` of initial
@@ -19,6 +19,14 @@ Two concrete implementations are exported from the package:
1919
write-overlay. Writes accumulate in memory and are flushed to KV in one batch
2020
when `flush()` is called. Reads are served from the overlay first, so callers
2121
always observe their own writes immediately.
22+
- `DurableObjectRawFileSystem` — a thin Durable Object KV-backed filesystem
23+
with no buffering. Every write is committed to KV synchronously. Use when
24+
per-write durability is preferred over batching.
25+
26+
`createFileSystemSnapshot` creates an `InMemoryFileSystem` from any sync or
27+
async iterable of `[path, content]` pairs, bridging async storage backends
28+
(e.g. `Workspace` from `@cloudflare/shell`) to the synchronous `FileSystem`
29+
interface.
2230

2331
The `FileSystem.read()` method returns `string | null` (null = file does not
2432
exist) rather than an empty string, eliminating the need for a separate

packages/worker-bundler/src/file-system.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ export class InMemoryFileSystem implements FileSystem {
7575
}
7676

7777
/**
78-
* A generic write-overlay on top of any `FileSystem`. Not exported — intended
79-
* as an implementation detail for higher-level filesystem classes.
78+
* A generic write-overlay on top of any `FileSystem`. Not re-exported from the
79+
* package entry point — intended as an implementation detail for higher-level
80+
* filesystem classes.
8081
*
8182
* Writes and deletes are buffered in memory keyed by the raw (untransformed)
8283
* path. Reads are served from the write buffer first; deleted paths return

0 commit comments

Comments
 (0)