fs-zoo
Version:
File system abstractions and implementations
37 lines (36 loc) • 1.78 kB
TypeScript
import type * as crud from '../crud/types';
declare class MemoryResource {
parent: MemoryCollection | undefined;
name: string;
data: Uint8Array;
created: number;
modified: number;
readable: boolean;
writable: boolean;
constructor(parent: MemoryCollection | undefined, name: string);
}
declare class MemoryCollection {
parent: MemoryCollection | undefined;
name: string;
children: Map<string, MemoryCollection | MemoryResource>;
constructor(parent?: MemoryCollection | undefined, name?: string);
created: number;
modified: number;
}
export declare class MemoryCrud implements crud.CrudApi {
protected readonly root: MemoryCollection | Promise<MemoryCollection>;
constructor(root?: MemoryCollection | Promise<MemoryCollection>);
protected _dir(collection: string[], create: boolean): Promise<[dir: MemoryCollection, parent: MemoryCollection | undefined]>;
protected _file(collection: string[], id: string): Promise<[dir: MemoryCollection, file: MemoryResource]>;
readonly put: (path: string, data?: Uint8Array | undefined, options?: crud.CrudPutOptions) => Promise<void>;
_get(collection: string[], id: string): Promise<MemoryResource>;
readonly getStream: (path: string) => Promise<ReadableStream>;
readonly del: (path: string, silent?: boolean) => Promise<void>;
readonly info: (path: string) => Promise<crud.CrudResourceInfo>;
readonly drop: (path: string, silent?: boolean) => Promise<void>;
readonly scan: (path: string) => AsyncIterableIterator<crud.CrudCollectionEntry>;
readonly list: (path: string) => Promise<crud.CrudCollectionEntry[]>;
readonly from: (path: string) => Promise<crud.CrudApi>;
readonly snapshot: () => Record<string, string | null>;
}
export {};