fs-zoo
Version:
File system abstractions and implementations
30 lines (29 loc) • 1.85 kB
TypeScript
import type { CrudApi, CrudApiExtended, CrudPutOptions, CrudResourceInfo, NestedSnapshot, FlatSnapshot, DeepCrudCollectionEntry } from './types';
export declare class CrudExtended implements CrudApiExtended {
protected _fs: CrudApi;
static from(fs: CrudApi): CrudExtended;
constructor(_fs: CrudApi);
exists(path: string): Promise<CrudResourceInfo | undefined>;
dir(path: string, options?: Pick<CrudPutOptions, 'throwIf'>): Promise<void>;
write(path: string, options?: CrudPutOptions): Promise<WritableStream>;
put(path: string, data?: string | Uint8Array | undefined, options?: CrudPutOptions): Promise<void>;
putUtf8(path: string, text: string, options?: CrudPutOptions): Promise<void>;
read(path: string): Promise<ReadableStream>;
get(path: string): Promise<Uint8Array>;
getUtf8(path: string): Promise<string>;
file(path: string): Promise<File>;
del(path: string, silent?: boolean): Promise<void>;
info(path: string): Promise<CrudResourceInfo>;
drop(path: string, silent?: boolean): Promise<void>;
scan(path: string): AsyncIterableIterator<import("./types").CrudCollectionEntry>;
list(path: string): Promise<import("./types").CrudCollectionEntry[]>;
from(path: string): Promise<CrudApiExtended>;
deepScan(path: string, prefix?: string): AsyncIterableIterator<DeepCrudCollectionEntry>;
cp(path: string, target: string): Promise<void>;
toNested(path?: string, fast?: boolean): Promise<NestedSnapshot>;
fromNested(snapshot: NestedSnapshot, path?: string): Promise<void>;
toFlat(path?: string, fast?: boolean, folders?: boolean, verbose?: boolean): Promise<FlatSnapshot>;
fromFlat(snapshot: FlatSnapshot, path?: string): Promise<void>;
toBytes(path?: string): Promise<ReadableStream>;
fromBytes(stream: ReadableStream, path?: string): Promise<void>;
}