fs-zoo
Version:
File system abstractions and implementations
30 lines (29 loc) • 1.43 kB
TypeScript
import type { FsApi } 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: FsApi;
readonly dir: string;
readonly separator?: string;
}
export declare class NodeCrud implements crud.CrudApi {
protected readonly options: NodeCrudOptions;
protected readonly fs: FsApi;
protected readonly _root: string;
protected readonly separator: string;
constructor(options: NodeCrudOptions);
protected _dir(collection: string[]): Promise<string>;
_file(collection: string[], id: string, flags: TFlags): Promise<IFileHandle>;
write(path: string, options?: crud.CrudPutOptions): Promise<WritableStream>;
private _createPositionedWritableStream;
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(path: string): AsyncIterableIterator<crud.CrudCollectionEntry>;
list(path: string): Promise<crud.CrudCollectionEntry[]>;
from(path: string): Promise<crud.CrudApi>;
}