ownfiles
Version:
A library to manage files in a Solid User's Pod
45 lines • 2.82 kB
TypeScript
import * as rdf from 'rdflib';
import { CreateOptions, ExtendedResponseType } from './create';
import { FileType, FolderType, ReadOptions, SingleFileType } from './read';
import { IndexEntry } from './deepRead';
import { IndexType } from './indexing';
export default class FileClient {
graph: rdf.IndexedFormula;
fetcher: rdf.Fetcher;
updater: rdf.UpdateManager;
indexPath: string;
indexURI?: string;
create: (this: FileClient, resourceAddress: string, options?: Partial<CreateOptions>) => Promise<Response>;
createFile: (this: FileClient, fileAddress: string, options: Partial<CreateOptions>) => Promise<Response>;
createFolder: (this: FileClient, folderAddress: string, options?: Partial<CreateOptions>) => Promise<Response>;
createIfNotExist: (this: FileClient, folderAddress: string, options?: Partial<CreateOptions> | undefined) => Promise<Response | undefined>;
read: (this: FileClient, resource: string, options?: Partial<ReadOptions>) => Promise<FolderType | Blob | SingleFileType | FileType | string>;
copy: (this: FileClient, resource: string, location: string) => Promise<unknown>;
renameFile: (this: FileClient, resource: string, newName: string) => Promise<unknown>;
renameFolder: (this: FileClient, resource: string, newName: string) => Promise<unknown>;
delete: (this: FileClient, resources: string | string[]) => Promise<ExtendedResponseType | ExtendedResponseType[]>;
deleteRecursively: (this: FileClient, resource: string) => Promise<ExtendedResponseType>;
update: (this: FileClient, resource: string, content: string, contentType?: string) => Promise<Response>;
deepRead: (this: FileClient, folderUrl: string, options?: Partial<{
auth: any;
verbose: boolean;
foundCallback: (item: string) => unknown;
}>) => Promise<(IndexEntry | string)[]>;
createIndex: (this: FileClient, user: string, options?: Partial<{
items: IndexType;
foundCallback: (item: any) => unknown;
}>) => Promise<IndexType | undefined>;
deleteIndex: (this: FileClient, user: string) => Promise<unknown>;
readIndex: (this: FileClient, user: string) => Promise<IndexType | undefined>;
addToIndex: (this: FileClient, item: IndexEntry | string, options?: {
force?: boolean;
updateCallback?: (uri: string | undefined | null, success: boolean, errorBody?: string, response?: Response | Error) => void;
}) => Promise<void>;
deleteFromIndex: (this: FileClient, item: string) => Promise<void[]>;
copyFile: (this: FileClient, resource: string, location: string) => Promise<Response>;
copyFolder: (this: FileClient, resource: string, location: string) => Promise<void>;
constructor({ indexPath }?: {
indexPath: string;
});
}
//# sourceMappingURL=fileClient.d.ts.map