UNPKG

@foxpage/foxpage-manager

Version:

foxpage resource manager

63 lines (62 loc) 1.68 kB
import { Application, FileManager, FPFile, Relations, ResourceUpdateInfo } from '@foxpage/foxpage-types'; import { ManagerBaseImpl } from '../common'; export declare class FileManagerImpl extends ManagerBaseImpl<FPFile> implements FileManager { /** * pathname and file id map * * @private */ private pathnameMap; /** * fileId and pathname map * * @private */ private fileMap; constructor(app: Application); /** * add a file * * @param {FPFile} file file content */ addFile(file: FPFile): FPFile; /** * remove files * * @param {string[]} fileIds file ids */ removeFiles(fileIds: string[]): Promise<void>; /** * get file via pathname * * @param {string} pathname * @return {Promise<FPFile | null>} */ getFileByPathname(pathname: string): Promise<FPFile | null>; /** * get file by fileId * @param fileId file id * @returns file */ getFileById(fileId: string, opt?: { autoFetch: boolean; autoCache?: boolean; }): Promise<FPFile | null>; /** * get pathname via file id * * @param {string} fileId * @return {Promise<string>} */ getPathnameByFileId(fileId: string): Promise<string>; protected onPull(data: ResourceUpdateInfo): Promise<void>; protected onStash(data: Relations): void; protected onFetch(fileIds: string[], opt?: { autoCache?: boolean; }): Promise<FPFile[]>; protected createInstance(data: FPFile): Promise<FPFile>; private getPathname; private addPathname; private removePathname; destroy(): void; }