@ai-ecoverse/slicc-kernel 1.8.11 → 1.8.12

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.
@@ -3023,6 +3023,11 @@ function statJson(s) {
3023
3023
  async function readdirStat(fs, dir) {
3024
3024
  return (await fs.readdirStat(dir)).map(([name2, stat]) => [name2, stat && statJson(stat)]);
3025
3025
  }
3026
+ async function storageUsage() {
3027
+ const estimate = await globalThis.navigator?.storage?.estimate?.();
3028
+ if (typeof estimate?.quota !== "number") return null;
3029
+ return { quota: estimate.quota, usage: estimate.usage ?? 0 };
3030
+ }
3026
3031
  var done = { ok: true, kind: "void" };
3027
3032
  function json(value) {
3028
3033
  return { ok: true, kind: "json", json: value };
@@ -3073,6 +3078,8 @@ async function run(fs, path, req, cwd) {
3073
3078
  case "utimes":
3074
3079
  await fs.utimes(path, new Date(req.atimeMs ?? 0), new Date(req.mtimeMs ?? 0));
3075
3080
  return done;
3081
+ case "statfs":
3082
+ return json(await storageUsage());
3076
3083
  default:
3077
3084
  return { ok: false, errno: "EINVAL", message: `sync-fs: unknown op '${req.op}'` };
3078
3085
  }