Hi all am currently trying to perform a

Hi all, am currently trying to perform a multi file upload using cloudflare workers and R2 but I keep getting this error
EntityTooSmall: Your proposed upload is smaller than the minimum allowed object size.
EntityTooSmall: Your proposed upload is smaller than the minimum allowed object size.
I previously tried using the workers R2 Runtime error and got the same error too. Any tips on how to debug this?
2 Replies
Ivan
Ivan14mo ago
I tried putting my source code together here in case anyone wants to give it a spin Workers : https://gist.github.com/ivanleomk/d31d49ce7412dc958bec353a273e0925
Gist
Cloudflare worker source code
Cloudflare worker source code. GitHub Gist: instantly share code, notes, and snippets.
Ivan
Ivan14mo ago
On the front end, I am splicing files using a simple .splice function.
export const createChunks = (
file: File,
chunkSize = 15 * 1024 * 1024 /* cSize should be byte 1024*1 = 1KB */
) => {
let offset = 0;
const originalFileExtension = getFileExtension(file);
console.log(`Identified Extension as ${originalFileExtension}`);
const chunks = [];
while (offset < file.size) {
const chunkEnd = Math.min(file.size, offset + chunkSize);
const truncatedBlob = file.slice(offset, chunkEnd);
const truncatedFile = new File(
[truncatedBlob],
`audio-${offset}-${chunkEnd}.${originalFileExtension}`,
{
type: file.type,
}
);
chunks.push(truncatedFile);
offset += chunkSize;
}
return chunks;
};
export const createChunks = (
file: File,
chunkSize = 15 * 1024 * 1024 /* cSize should be byte 1024*1 = 1KB */
) => {
let offset = 0;
const originalFileExtension = getFileExtension(file);
console.log(`Identified Extension as ${originalFileExtension}`);
const chunks = [];
while (offset < file.size) {
const chunkEnd = Math.min(file.size, offset + chunkSize);
const truncatedBlob = file.slice(offset, chunkEnd);
const truncatedFile = new File(
[truncatedBlob],
`audio-${offset}-${chunkEnd}.${originalFileExtension}`,
{
type: file.type,
}
);
chunks.push(truncatedFile);
offset += chunkSize;
}
return chunks;
};