///
import { AxiosResponse } from "axios";
import WebTorrent from "webtorrent";
export declare const client: WebTorrent.Instance;
export declare const FILE_TYPE: {
TORRENT: string;
DEFAULT: string;
};
export declare const UPLOAD_TYPE: string[];
export type UploadType = (typeof UPLOAD_TYPE)[number];
export interface BufferTorrent extends Buffer {
infoHash?: string;
magnetURI?: Uint8Array;
name?: string;
size?: number;
}
export interface BufferData extends Buffer {
name?: string;
}
export interface GetUploadUrlConfig {
path: string;
filename: string;
contentLength: number;
contentType: string;
method: UploadType;
cidFile: string;
cidTorrentFile: string;
action?: string;
keepPath?: boolean;
}
export interface UploadUrl {
uploadFileUrl: string;
webseed: string[];
uploadTorrentUrl: string;
filePath: string;
cidTorrentFile: string;
cidFile: string;
contentType: string;
contentLength: number;
filename: string;
keepPath: boolean;
action: string;
method: UploadType;
}
type Omit = Pick>;
interface UploadOptions {
file: File;
path: string[];
projectId: string;
uploadType: UploadType;
inFolder: boolean;
exportedKey?: string;
onUploadProgress: () => void;
account: string;
}
export interface UploadFileOptions extends UploadOptions {
isLargeFile?: boolean;
chunkSize?: number;
uploadUrl?: UploadUrl;
callback?: (bufferData: BufferData, webseed: string[], account: string) => void;
}
interface UploadFileWithSignedUrlOptions {
uploadUrl: string;
uploadTorrentUrl: string;
exportedKey?: string;
}
export interface UploadFolderOptions extends Omit {
files: FileList | File[];
}
interface FileForShare {
fileId: string;
encryptKey: string;
}
interface Keys {
masterKey: CryptoKey;
iv: any;
}
export declare const uploadFolder: (token: string, publicKey: string, account: string, options: UploadFolderOptions) => Promise;
export declare const uploadFile: (token: string, publicKey: string, options: UploadFileOptions) => Promise;
export declare const uploadFileWithSignedUrl: (file: File, options: UploadFileWithSignedUrlOptions) => Promise;
export declare const getCid: (file: File, exportedKey?: string) => Promise<{
status: number;
data: {
cidFile: string;
cidTorrentFile: string;
};
}>;
export declare const getFileByLongPath: (projectId: string, type: boolean, filePath: string, token: any) => Promise;
export declare const getUploadUrls: (projectId: string, config: GetUploadUrlConfig[], token: string) => Promise;
export declare const upload: (formData: FormData, url: string, fileType: string, bufferData: BufferTorrent, onUploadProgress?: (progressEvent: any, name: any) => void) => Promise>;
export declare const getDetailUnencryptedFile: (token: string, torrentUrl: string, onProcess?: (torrent: any, remaining: any) => void) => Promise;
export declare const getDetailEncryptedFile: (torrentUrl: any, key: string, token: string, isShare: boolean, webSeed?: any, account?: any, onProcess?: (torrent: any, remaining: any) => void, keys?: Keys) => Promise;
export declare const getDetailMultiEncryptedFiles: (ids: Array | Array, token: string, isShare: boolean, account: string, onProcess?: (torrent: any, remaining: any) => void) => Promise;
export declare const createFolder: (folderName: string, token: string, currentPathArray: string[]) => Promise;
export declare const getDetailFile: (id: string | number) => Promise;
export declare const getFileById: (id: string | number, token?: string) => Promise;
export declare const getFileListById: (ids: Array | Array, token?: string) => Promise;
export declare const deleteFile: (file_id: string | number, token?: string) => Promise;
export declare const deleteFolder: (projectId: string, folderPath: string, token?: string) => Promise;
export declare const downloadFile: (torrentUrl: string, token: string, onDownload: () => void) => Promise;
export declare const shareFile: (toPublicKey: string, chosenId: string, fileType: UploadType) => Promise;
export declare const shareMultiFile: (toPublicKey: string, fileList: Array, fileType: UploadType) => Promise;
export declare const onShare: (body: object, token?: string) => Promise;
export declare const onShareMultiFile: (body: object, token?: string) => Promise;
export declare const getShareList: (id: string | number, token?: string) => Promise;
export declare const getShareListToMe: (page?: number, pageSize?: number, projectId?: string, relFolderPath?: string) => Promise;
export declare const getListShareWithMebyIds: (ids: Array | Array) => Promise;
export declare const deleteSharePermission: (shareId: string | number, token?: string) => Promise;
export declare const getMasterKey: (key: string) => Promise;
export declare const getMultiMasterKey: (keys: Array) => Promise;
export declare const genKeyFromExportKey: (exportKey: any) => Promise;
export declare const uploadKeyUpdate: (projectId: any, filePath: any, encryptKey: any, token: any) => Promise>;
export {};