index.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.fsa = exports.coreToFsa = void 0;
  4. const tslib_1 = require("tslib");
  5. const CoreFileSystemDirectoryHandle_1 = require("./CoreFileSystemDirectoryHandle");
  6. const Superblock_1 = require("../core/Superblock");
  7. tslib_1.__exportStar(require("./types"), exports);
  8. tslib_1.__exportStar(require("./CoreFileSystemHandle"), exports);
  9. tslib_1.__exportStar(require("./CoreFileSystemDirectoryHandle"), exports);
  10. tslib_1.__exportStar(require("./CoreFileSystemFileHandle"), exports);
  11. tslib_1.__exportStar(require("./CoreFileSystemSyncAccessHandle"), exports);
  12. tslib_1.__exportStar(require("./CoreFileSystemWritableFileStream"), exports);
  13. tslib_1.__exportStar(require("./CorePermissionStatus"), exports);
  14. /**
  15. * Creates a File System Access API implementation on top of a Superblock.
  16. */
  17. const coreToFsa = (core, dirPath = '/', ctx) => {
  18. return new CoreFileSystemDirectoryHandle_1.CoreFileSystemDirectoryHandle(core, dirPath, ctx);
  19. };
  20. exports.coreToFsa = coreToFsa;
  21. /**
  22. * Create a new instance of an in-memory File System Access API
  23. * implementation rooted at the root directory of the filesystem.
  24. *
  25. * @param ctx Optional context for the File System Access API.
  26. * @returns A File System Access API implementation `dir` rooted at
  27. * the root directory of the filesystem, as well as the `core`
  28. * file system itself.
  29. */
  30. const fsa = (ctx) => {
  31. const core = new Superblock_1.Superblock();
  32. const dir = new CoreFileSystemDirectoryHandle_1.CoreFileSystemDirectoryHandle(core, '/', ctx);
  33. return { dir, core };
  34. };
  35. exports.fsa = fsa;
  36. //# sourceMappingURL=index.js.map