The checksum attribute is a Base64 version of your file MD5. Here's a TypeScript sample of how mounting those files in a browser will look like.
constconvertFileToMd5= (file:File):Promise<string> => {returnnewPromise((resolve, reject) => {constreader=newFileReader();reader.onload=function (event) {constbinary=event.target?.result;if (binary) {constwordArray=enc.Latin1.parse(binary asstring);constmd5=MD5(wordArray).toString();resolve(md5); } else {reject(newError('Failed to read file')); } };reader.onerror=function (error) {reject(error); };reader.readAsBinaryString(file); });};constmountFileToSend= (file:File, md5:string) => {constbase64=btoa( md5.match(/\w{2}/g)!.map((a) =>String.fromCharCode(parseInt(a,16))).join('') );return { key:'', filename:file.name, byte_size:file.size, checksum: base64, content_type:file.type, size:file.size, };};// usageconstmd5=awaitconvertFileToMd5(file);// this is what will be sent to the APIconstfileData=mountFileToSend(file, md5);
Response
The important key here is direct_upload, that's where the signed url that the file will be sent to is, it's also the place where the headers live, those will also be sent to the same URL as part of the PUT request.
here's an example on how the request would look like in TypeScript.
fetch(direct_upload.url, { method:'PUT', headers:direct_upload.headers asRecord<string,string >,// the same file we generated the MD5 from, you can send the File itself body: file, });