index.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.fsa = void 0;
  4. const tslib_1 = require("tslib");
  5. const CoreFileSystemDirectoryHandle_1 = require("./CoreFileSystemDirectoryHandle");
  6. const Superblock_1 = require("../core/Superblock");
  7. const CoreFileSystemObserver_1 = require("./CoreFileSystemObserver");
  8. tslib_1.__exportStar(require("./types"), exports);
  9. tslib_1.__exportStar(require("./CoreFileSystemHandle"), exports);
  10. tslib_1.__exportStar(require("./CoreFileSystemDirectoryHandle"), exports);
  11. tslib_1.__exportStar(require("./CoreFileSystemFileHandle"), exports);
  12. tslib_1.__exportStar(require("./CoreFileSystemSyncAccessHandle"), exports);
  13. tslib_1.__exportStar(require("./CoreFileSystemWritableFileStream"), exports);
  14. tslib_1.__exportStar(require("./CoreFileSystemObserver"), exports);
  15. tslib_1.__exportStar(require("./CorePermissionStatus"), exports);
  16. /**
  17. * Create a new instance of an in-memory File System Access API
  18. * implementation rooted at the root directory of the filesystem.
  19. *
  20. * @param ctx Optional context for the File System Access API.
  21. * @param core Optional low-level file system implementation to
  22. * back the File System Access API. If not provided, a new empty
  23. * Superblock instance will be created.
  24. * @param dirPath Optional path within the filesystem to use as the root
  25. * directory of the File System Access API. Defaults to `/`.
  26. * @returns A File System Access API implementation `dir` rooted at
  27. * the root directory of the filesystem, as well as the `core`,
  28. * a low-level file system implementation itself. Also, returns
  29. * `FileSystemObserver`, a class that can be used to create
  30. * observers that watch for changes to files and directories.
  31. */
  32. const fsa = (ctx, core = new Superblock_1.Superblock(), dirPath = '/') => {
  33. const dir = new CoreFileSystemDirectoryHandle_1.CoreFileSystemDirectoryHandle(core, dirPath, ctx);
  34. const FileSystemObserver = class FileSystemObserver extends CoreFileSystemObserver_1.CoreFileSystemObserver {
  35. constructor(callback) {
  36. super(core, callback);
  37. }
  38. };
  39. return { core, dir, FileSystemObserver };
  40. };
  41. exports.fsa = fsa;
  42. //# sourceMappingURL=index.js.map