export interface WatchHandle { /** * Stop watching. */ close(): void; } /** * Metadata of a file that a component can compare between two observations to detect a * change. */ export interface FileStats { /** * The time, in ms since POSIX epoch, that the file was last modified. */ timestamp: number; /** * The size of the file in bytes. */ size: number; } /** * Interface for doing filesystem operations on the platform. */ export interface Filesystem { /** * The time, in ms since POSIX epoch, that the file was last modified. * @param path The path to get a timestamp for. * * @returns A promise which will resolve to a timestamp if successful, or be * rejected if the operation fails. */ getFileTimestamp(path: string): Promise; /** * Read a file into a utf8 encoded string. * @param path The path of the file to read. * * @returns A promise which will resolve to utf8 encoded file content, or be * rejected if the operation fails. */ readFile(path: string): Promise; /** * Get the metadata of a file. Components use it to detect that a file changed, appeared, or * disappeared. * * @param path The path of the file. * * @returns A promise which will resolve to the file metadata, or to undefined when the file * does not exist. The promise is rejected when the operation fails for another reason. */ getFileStats?(path: string): Promise; /** * Watch for changes to the specified path. * * The implementation of this methods should be non-persistent. Meaning that * it should not keep the containing process running as long as it is * executing. For node this means setting the persistent option to false. * * When the watch itself fails, the implementation should invoke the callback with the event * type `error` instead of raising, so that the owner of the watch can set it up again. * * @param path The path to watch. * @param callback Receives the event type, the watched path, and, when the platform reports * it, the name of the entry within the watched path that changed. The name is undefined when * the platform does not report it. * * @returns An async iterator that watches for changes to `path`. */ watch(path: string, callback: (eventType: string, filename: string, changedName?: string) => void): WatchHandle; } //# sourceMappingURL=Filesystem.d.ts.map