host.d.ts 2.0 KB

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