
As the title says. I have a large file (3GB) that I would like to make downloadable. However i am running into the issue where for some reason code that executes just stays hanging. I have tried a work around by using a direct URL but it still hangs.
Code:
try{
console.log("Got Request")
const client = await CreateAdminClient();
const storage = new Storage(client);
const ID = (await storage.listFiles(bucketID,[],filename)).files[0].$id;
console.log("Got File")
// HANGS HERE
const response = `https://${process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT}}/storage/buckets/${bucketID}/files/${ID}/download?project=${process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID}`
console.log(response);
//const response = await storage.getFile(bucketID,ID);
console.log("Got Download Link")
return {code:200,message:response};
}
catch(error){
return {code:404,message:error};
}

Also. if i run the response command, it only downloads a single chunk

// HANGS HERE
After logging "Got File
"?

Yeah. i did some more testing and i think its because it is trying to server the entire file at once instead of in chunks.

You're not actually downloading anything in the code fragment, as far as I can see

true, i am getting the download link and then sending it to my front end.

const handleDownload = async (filename: string, index: number) => {
setDisabledButtons((prev) => [...prev, index]);
console.log("Button has been pressed. preparing download")
const response = await GetDownloadLink(bucketID,filename);
if(response.code === 200){
const blob = new Blob([response.message as BlobPart]);
const url = window.URL.createObjectURL(blob);
const a = document.createElement("a");
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
a.remove();
window.URL.revokeObjectURL(url);
}
setTimeout(() => {
setDisabledButtons((prev) => prev.filter((i) => i !== index));
}, 5000); // Re-enable the button after 5 seconds
};

Is this in a Function? Otherwise, this doesn't look like an Appwrite issue

It definitely is an appwrite issue. It seems like it does eventually download but it takes like 10 minutes until i get a response from await storage.getFile(bucketID,ID)

I don't see a call to storage.getFile()
anywhere in your code fragment

Well, there is, but it's commented out

its the part that is commented out, i check with just a direct link and with the SDK function. The direct link only download a 15kb file and the sdk function takes 10 minutes until it returns

Is it possible there was an issue with the upload?

no, because i go to my storage and download from there it does work without issue. I think it might have to do with the fact that the file is 3GB.

Recommended threads
- Im getting this error when i try to crea...
SSLV3_ALERT_BAD_RECORD_MAC(tls_record.cc:583) error 268436476, uri=https://cloud.appwrite.io/v1/storage/buckets/67bxxxxxxxxxxxxd026/files (0) as well as this e...
- Setting SMTP does nothing - running appw...
I have set up a local image to play with and develop locally which i can authenticate to and make database and collection not problem. Trying to test out sendin...
- domain SSL error
im getting error when executing ssl ``` appwrite-worker-certificates | [Job] Received Job (67bfb1dc953401.66385800). appwrite-worker-certificates | Cannot re...
