UNPKG

fs-zoo

Version:

File system abstractions and implementations

37 lines (36 loc) 1.68 kB
import type * as crud from '../crud/types'; type CowState = { files: Set<string>; cols: Set<string>; }; /** * Copy-on-write CRUD-fs. Accepts two file systems: (1) *base* the source of data; * (2) *overlay* the writable layer. Initially all reads are served from the * *base* layer, if a file or folder structure gets "tainted" (modified) a copy * of those resources are copied and modified in the *overlay* layer. Subsequently, * the reads of tainted resources will be served from the *overlay* layer. */ export declare class CowCrud implements crud.CrudApi { protected readonly base: crud.CrudApi; protected readonly overlay: crud.CrudApi; protected readonly _state: CowState; constructor(base: crud.CrudApi, overlay: crud.CrudApi, state?: CowState); private _fullPath; private _isColTombstoned; private _isFileTombstoned; private _existsResource; private _existsCollection; private _clearFileTombstone; write(path: string, options?: crud.CrudPutOptions): Promise<WritableStream>; dir(path: string, options?: Pick<crud.CrudPutOptions, 'throwIf'>): Promise<void>; put(path: string, data: Uint8Array, options?: crud.CrudPutOptions): Promise<void>; read(path: string): Promise<ReadableStream>; file(path: string): Promise<File>; del(path: string, silent?: boolean): Promise<void>; info(path: string): Promise<crud.CrudResourceInfo>; drop(path: string, silent?: boolean): Promise<void>; scan(this: CowCrud, path: string): AsyncIterableIterator<crud.CrudCollectionEntry>; list(path: string): Promise<crud.CrudCollectionEntry[]>; from(path: string): Promise<crud.CrudApi>; } export {};