@poe-platform/safe-fs 0.1.815 → 0.1.816
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/safe-fs/fs/mount/index.js +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -317,6 +317,8 @@ Every raw filesystem operation accepts an optional `signal`. Additional fields a
|
|
|
317
317
|
|
|
318
318
|
`access` takes a separate mode bitmask from `ACCESS_MODES`. `chmod` takes a mode, `utimes` takes millisecond timestamps, and `truncate` takes a byte length (default 0). For conditional chmod, check `capabilitiesFor(path, { conditionalChmod: true })` (or `capabilities`) and require `conditionalChmod: true`; supply `parent`, `expected`, and complete root-to-parent `ancestors` together. An optional mutation-free `commitGuard` must return literal `true` synchronously. Memory validates at its metadata commit; mount and supported Memory overlays preserve wrapper ancestry. Real uses its existing externally isolated host-tree boundary and does not prevent races with other processes. Backend limits still apply. Node-shaped bridge methods translate their own options rather than accepting these raw option objects; see the [bridge signatures](src/bridge/filesystem.ts).
|
|
319
319
|
|
|
320
|
+
Cross-mount streamed copies start reading the source before opening the destination for writing. An initial read failure leaves the destination unchanged; later read or write failures can leave partial destination bytes.
|
|
321
|
+
|
|
320
322
|
Overlay copy-up, copy, stream replacement/append and resize transfer retained ranges in 64 KiB chunks through the injected upper's stream writer. Resize streams the retained prefix and bounded zero chunks. Stream writes stage input before publication; cancellation or transfer failure leaves the destination unchanged and cleans staging. Stock Memory overlays transfer staged storage into existing upper inodes, preserving hardlinks without an additional whole-file buffer. `readFile` and `writeFile` remain buffering convenience APIs; use `readStream`/`writeStream` for large payloads. `maxBufferBytes` retains its existing optional total-byte admission semantics, not a working-memory guarantee.
|
|
321
323
|
|
|
322
324
|
A streaming overlay needs an upper with `atomicRename`, `streamingWrite`, retained reads (`retainedRead` plus `openReadFile`), exclusive create, directory mutation, permissions and timestamps. Both layers must provide retained, bounded range reads with stable file and directory identities. For example, inject these host-authorized adapters with `createOverlayFileSystem({ upper: externalSpool, lower: retainedSource })`, then use `overlay.writeStream(path, source)`. The upper must await each consumed chunk, keep transport queues bounded, and preserve ownership until publication. Supply bounded chunks at the input boundary; the overlay cannot undo a payload-wide allocation already made by its caller. Whole-file-only uppers explicitly reject transfer operations with `ENOTSUP`; they do not silently collect streams.
|
|
@@ -1308,7 +1308,16 @@ export class MountFileSystem {
|
|
|
1308
1308
|
const source = readBytes(reader.readStream(origin.local, options), options.signal);
|
|
1309
1309
|
let failed = false;
|
|
1310
1310
|
try {
|
|
1311
|
-
|
|
1311
|
+
// Admit lazy reader startup before the writer can truncate its target.
|
|
1312
|
+
// Later transfer failures retain the backend's partial-write semantics.
|
|
1313
|
+
const first = await source.next();
|
|
1314
|
+
await writer.writeStream(target.local, (async function* () {
|
|
1315
|
+
let item = first;
|
|
1316
|
+
while (!item.done) {
|
|
1317
|
+
yield item.value;
|
|
1318
|
+
item = await source.next();
|
|
1319
|
+
}
|
|
1320
|
+
})(), writeOptions);
|
|
1312
1321
|
}
|
|
1313
1322
|
catch (error) {
|
|
1314
1323
|
failed = true;
|