uploadFile()
Syntax
uploadFile(token: string, publicKey: string, options: UploadFileOptions)Parameters
Name
Type
Required
Description
interface UploadOptions {
file: File;
path: string[]; // Path file
projectId: string;
uploadType: UploadType;
inFolder: boolean;
exportedKey?: string; // Need if encrypt
onUploadProgress: () => void; // Progress upload file,
account: string;
}
export interface UploadFileOptions extends UploadOptions {
isLargeFile?: boolean; // file's size > 20MB
chunkSize?: number; // size of each chunk part, recommend 5MB
uploadUrl?: UploadUrl; // must be ignored when uploading a single file
callback?: (
bufferData: BufferData,
webseed: string[],
account: string
) => void; // callback must be ignored when uploading a single file
}Example
Last updated