@poe-platform/safe-fs 0.1.43 → 0.1.45

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.
@@ -23,6 +23,7 @@ export interface DirectoryEntry {
23
23
  }
24
24
  export interface FileSystemCapabilities {
25
25
  readonly readOnly?: boolean;
26
+ readonly append?: boolean;
26
27
  readonly symlinks?: boolean;
27
28
  readonly hardlinks?: boolean;
28
29
  readonly permissions?: boolean;
@@ -77,9 +77,12 @@ export class MountFileSystem {
77
77
  const streaming = (capability, method) => all(capability, [method]) ? true : mounts.some(({ backend }) => backend.capabilities[capability] !== false && typeof backend[method] === "function") ? undefined : false;
78
78
  const streamingRead = streaming("streamingRead", "readStream");
79
79
  const streamingWrite = streaming("streamingWrite", "writeStream");
80
+ const append = all("append") ? true
81
+ : mounts.every(({ backend }) => backend.capabilities.append === false) ? false : undefined;
80
82
  this.capabilities = Object.freeze({
81
83
  get snapshotRmdir() { return mounts.some(({ backend }) => backend.capabilities.snapshotRmdir === true); },
82
84
  readOnly: all("readOnly"),
85
+ ...(append === undefined ? {} : { append }),
83
86
  symlinks: all("symlinks", ["readlink", "symlink"]),
84
87
  hardlinks: all("hardlinks", ["link"]),
85
88
  permissions: all("permissions", ["chmod"]),
@@ -81,8 +81,11 @@ export class OverlayFileSystem {
81
81
  && this.#upper.capabilities.streamingRead === true
82
82
  && typeof this.#upper.writeStream === "function" && typeof this.#upper.readStream === "function"
83
83
  ? readable.every((capability) => capability === true) ? true : undefined : false;
84
+ const append = !writable || this.#upper.capabilities.append === false ? false
85
+ : this.#upper.capabilities.append === true ? true : undefined;
84
86
  this.capabilities = Object.freeze({
85
87
  readOnly: !writable,
88
+ ...(append === undefined ? {} : { append }),
86
89
  atomicRename: false,
87
90
  hardlinks: false,
88
91
  symlinks: writable && this.#upper.capabilities.symlinks === true
@@ -28,6 +28,7 @@ export class ReadOnlyFileSystem {
28
28
  const streamingRead = typeof filesystem.readStream === "function" ? filesystem.capabilities.streamingRead : false;
29
29
  this.#capabilities = Object.freeze({
30
30
  readOnly: true,
31
+ append: false,
31
32
  symlinks: filesystem.capabilities.symlinks === true && typeof filesystem.readlink === "function",
32
33
  hardlinks: false,
33
34
  permissions: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-fs",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
4
4
  "description": "Composable filesystem with a portable core and explicit Node adapters",
5
5
  "type": "module",
6
6
  "license": "MIT",