fs-zoo
Version:
File system abstractions and implementations
26 lines (25 loc) • 1.32 kB
TypeScript
import type { FsPromisesApi } from 'memfs/lib/node/types';
import type * as crud from '../crud/types';
import type { IFileHandle, TFlags } from 'memfs/lib/node/types/misc';
export interface NodeCrudOptions {
readonly fs: FsPromisesApi;
readonly dir: string;
readonly separator?: string;
}
export declare class NodeCrud implements crud.CrudApi {
protected readonly options: NodeCrudOptions;
protected readonly fs: FsPromisesApi;
protected readonly dir: string;
protected readonly separator: string;
constructor(options: NodeCrudOptions);
protected _dir(collection: string[]): Promise<string>;
_file(collection: string[], id: string, flags: TFlags): Promise<IFileHandle>;
readonly put: (path: string, data?: Uint8Array | undefined, options?: crud.CrudPutOptions) => Promise<void>;
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>;
}