UNPKG

fs-zoo

Version:

File system abstractions and implementations

32 lines (31 loc) 1.06 kB
import { Router, RouterCrud, Routing } from '../router/RouterCrud'; import type * as crud from '../crud/types'; declare class OverlayRouter implements Router { layers: Record<string, crud.CrudApi>; constructor(layers: Record<string, crud.CrudApi>); resolve(path: string): Routing; nested(path: string): Routing[]; } /** * An "overlay" file system, which can combine multiple CRUD-fs file systems * into one. Accepts one default file system and any number of additional * file systems to overlay on top at specific paths. * * A layer mounted at `''` (or `[]`) will be the default file system, it will * receive all requests that do not match any other layer. * * Example: * * ``` * const fs = new OverlayCrud(); * fs.overlay([], root); * fs.overlay(['usr', 'virtual'], userHome); * ``` */ export declare class OverlayCrud extends RouterCrud { protected _router: OverlayRouter; constructor(layers?: Record<string, crud.CrudApi>); mount(path: string, fs: crud.CrudApi): void; unmount(path: string): boolean; } export {};