typebulb 0.58.2 → 0.59.1

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/dist/render.js CHANGED
@@ -799,6 +799,29 @@ ${B1}
799
799
  });
800
800
  await failIfNotOk(resp, 'write', path);
801
801
  return true;
802
+ },
803
+ // Immediate children of a folder (default: the bulb's own), as { name, dir, mtime }[].
804
+ list: async (path = '.') => {
805
+ if (isFramed) throw inlineErr('tb.fs');
806
+ const resp = await fetch('/__fs/list', {
807
+ method: 'POST',
808
+ headers: { 'Content-Type': 'application/json' },
809
+ body: JSON.stringify({ path })
810
+ });
811
+ await failIfNotOk(resp, 'list', path);
812
+ return resp.json();
813
+ },
814
+ // Remove a file, or a folder and its contents. Throws on a missing path; the bulb's folder
815
+ // itself is refused.
816
+ remove: async (path) => {
817
+ if (isFramed) throw inlineErr('tb.fs');
818
+ const resp = await fetch('/__fs/remove', {
819
+ method: 'POST',
820
+ headers: { 'Content-Type': 'application/json' },
821
+ body: JSON.stringify({ path })
822
+ });
823
+ await failIfNotOk(resp, 'remove', path);
824
+ return true;
802
825
  }
803
826
  };
804
827