NodeFileSystemHandle.d.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { NodePermissionStatus } from './NodePermissionStatus';
  2. import type { IFileSystemHandle, FileSystemHandlePermissionDescriptor } from '../fsa/types';
  3. import type { NodeFsaFs, NodeFsaContext } from './types';
  4. /**
  5. * Represents a File System Access API file handle `FileSystemHandle` object,
  6. * which was created from a Node.js `fs` module.
  7. *
  8. * @see [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle)
  9. */
  10. export declare abstract class NodeFileSystemHandle implements IFileSystemHandle {
  11. readonly kind: 'file' | 'directory';
  12. readonly name: string;
  13. protected abstract readonly fs: NodeFsaFs;
  14. protected abstract readonly __path: string;
  15. protected abstract readonly ctx: NodeFsaContext;
  16. constructor(kind: 'file' | 'directory', name: string);
  17. /**
  18. * Compares two handles to see if the associated entries (either a file or directory) match.
  19. *
  20. * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/isSameEntry
  21. */
  22. isSameEntry(fileSystemHandle: IFileSystemHandle): boolean;
  23. /**
  24. * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/queryPermission
  25. */
  26. queryPermission(fileSystemHandlePermissionDescriptor: FileSystemHandlePermissionDescriptor): Promise<NodePermissionStatus>;
  27. /**
  28. * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/remove
  29. */
  30. remove({ recursive }?: {
  31. recursive?: boolean;
  32. }): Promise<void>;
  33. /**
  34. * @see https://developer.mozilla.org/en-US/docs/Web/API/FileSystemHandle/requestPermission
  35. */
  36. requestPermission(fileSystemHandlePermissionDescriptor: FileSystemHandlePermissionDescriptor): NodePermissionStatus;
  37. }