host.d.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.dev/license
  7. */
  8. import { Stats } from 'node:fs';
  9. import { Observable } from 'rxjs';
  10. import { Path, PathFragment, virtualFs } from '../src';
  11. /**
  12. * An implementation of the Virtual FS using Node as the background. There are two versions; one
  13. * synchronous and one asynchronous.
  14. */
  15. export declare class NodeJsAsyncHost implements virtualFs.Host<Stats> {
  16. get capabilities(): virtualFs.HostCapabilities;
  17. write(path: Path, content: virtualFs.FileBuffer): Observable<void>;
  18. read(path: Path): Observable<virtualFs.FileBuffer>;
  19. delete(path: Path): Observable<void>;
  20. rename(from: Path, to: Path): Observable<void>;
  21. list(path: Path): Observable<PathFragment[]>;
  22. exists(path: Path): Observable<boolean>;
  23. isDirectory(path: Path): Observable<boolean>;
  24. isFile(path: Path): Observable<boolean>;
  25. stat(path: Path): Observable<virtualFs.Stats<Stats>>;
  26. watch(path: Path, _options?: virtualFs.HostWatchOptions): Observable<virtualFs.HostWatchEvent> | null;
  27. }
  28. /**
  29. * An implementation of the Virtual FS using Node as the backend, synchronously.
  30. */
  31. export declare class NodeJsSyncHost implements virtualFs.Host<Stats> {
  32. get capabilities(): virtualFs.HostCapabilities;
  33. write(path: Path, content: virtualFs.FileBuffer): Observable<void>;
  34. read(path: Path): Observable<virtualFs.FileBuffer>;
  35. delete(path: Path): Observable<void>;
  36. rename(from: Path, to: Path): Observable<void>;
  37. list(path: Path): Observable<PathFragment[]>;
  38. exists(path: Path): Observable<boolean>;
  39. isDirectory(path: Path): Observable<boolean>;
  40. isFile(path: Path): Observable<boolean>;
  41. stat(path: Path): Observable<virtualFs.Stats<Stats>>;
  42. watch(path: Path, _options?: virtualFs.HostWatchOptions): Observable<virtualFs.HostWatchEvent> | null;
  43. }