kura
Version:
The FileSystem API abstraction library.
67 lines • 4.05 kB
TypeScript
/// <reference types="node" />
import { ContentsCache } from "./ContentsCache";
import { DataType, FileSystem } from "./filesystem";
import { FileNameIndex, Record, RecordCache } from "./FileSystemIndex";
import { FileSystemObject } from "./FileSystemObject";
import { FileSystemOptions } from "./FileSystemOptions";
export declare abstract class AbstractAccessor {
readonly options: FileSystemOptions;
protected contentsCache: ContentsCache;
protected recordCache: RecordCache;
abstract readonly filesystem: FileSystem;
abstract readonly name: string;
constructor(options: FileSystemOptions);
clearContentsCache(fullPath: string): void;
createIndexPath(fullPath: string, createDirectory: boolean): Promise<string>;
createRecord(obj: FileSystemObject): Promise<Record>;
delete(fullPath: string, isFile: boolean, truncate: boolean): Promise<void>;
deleteRecord(fullPath: string, _isFile: boolean): Promise<void>;
deleteRecursively(fullPath: string, truncate: boolean): Promise<void>;
doPutObject(obj: FileSystemObject, content?: Blob | BufferSource | string): Promise<FileSystemObject>;
doWriteContent(fullPath: string, content: Blob | BufferSource | string): Promise<void>;
getFileNameIndex(dirPath: string): Promise<FileNameIndex>;
getObject(fullPath: string, isFile: boolean): Promise<FileSystemObject>;
getObjects(dirPath: string): Promise<FileSystemObject[]>;
getRecord(fullPath: string): Promise<Record>;
getURL(_fullPath: string, _method?: "GET" | "POST" | "PUT" | "DELETE"): Promise<string>;
makeDirectory(fullPath: string): Promise<void>;
purge(): Promise<void>;
putObject(obj: FileSystemObject, content?: Blob | BufferSource | string): Promise<FileSystemObject>;
putText(obj: FileSystemObject, text: string): Promise<FileSystemObject>;
readContent(obj: FileSystemObject, type?: DataType): Promise<Blob | BufferSource | string>;
readContentInternal(obj: FileSystemObject, type?: DataType): Promise<Blob | BufferSource | string>;
readText(obj: FileSystemObject): Promise<string>;
remove(obj: FileSystemObject): Promise<void>;
removeRecursively(obj: FileSystemObject): Promise<void>;
saveRecord(fullPath: string, record: Record): Promise<Record>;
truncateRecord(fullPath: string): Promise<void>;
abstract doDelete(fullPath: string, isFile: boolean): Promise<void>;
abstract doGetObject(fullPath: string, isFile: boolean): Promise<FileSystemObject>;
abstract doGetObjects(dirPath: string): Promise<FileSystemObject[]>;
abstract doMakeDirectory(fullPath: string): Promise<void>;
abstract doReadContent(fullPath: string): Promise<Blob | BufferSource | string>;
protected debug(title: string, value: string | FileSystemObject): void;
protected doSaveRecord(indexPath: string, record: Record): Promise<void>;
protected doWriteUint8Array(fullPath: string, view: Uint8Array): Promise<void>;
protected handleNotFoundError(fullPath: string, isFile: boolean): Promise<void>;
protected handleReadError(e: any, fullPath: string, isFile: boolean): Promise<void>;
protected handleWriteError(e: any, fullPath: string, isFile: boolean): Promise<void>;
protected initialize(options: FileSystemOptions): void;
protected initializeContentsCacheOptions(options: FileSystemOptions): void;
protected initializeIndexOptions(options: FileSystemOptions): void;
protected abstract doWriteArrayBuffer(fullPath: string, buffer: ArrayBuffer): Promise<void>;
protected abstract doWriteBase64(fullPath: string, base64: string): Promise<void>;
protected abstract doWriteBlob(fullPath: string, blob: Blob): Promise<void>;
protected abstract doWriteBuffer(fullPath: string, buffer: Buffer): Promise<void>;
private afterDelete;
private afterGet;
private afterHead;
private afterPost;
private afterPut;
private beforeDelete;
private beforeGet;
private beforeHead;
private beforePost;
private beforePut;
}
//# sourceMappingURL=AbstractAccessor.d.ts.map