The method used to upload files in Eueno. We have two types to upload are encrypted and unencrypted.
Parameters
Name
Type
Required
Description
token
string
Yes
The authentication token response from Eueno API when login. After login, this token was saved in local storage with the name “eueno-token".
publicKey
string
Yes
The public key of user.
options
UploadFileOptions
Yes
Type UploadFileOptions has the structure like this:
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
Example using ReactJS with Axios. Assuming that, you have a project named Project1 with id is “112”, inside this project we have Folder1, and inside Folder1 we have Folder2. So the path is like this: Project1/Folder1/Folder2. The code below shows how to upload a file by encrypt method in Folder2.