function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Nikhil Garg 17Nikhil Garg 17 

Static Resource File Size

Hi Team,

I have a zip file which I need to store to the static resource to have dependencies on my JS file. but My file size if 28 MB and static resource only takes 5 MB.
Is there any other way to save that ZIp file to static resource.

Regards
Nikhil
SwethaSwetha (Salesforce Developers) 
HI Nikhil,
As per Salesforce documentation(https://help.salesforce.com/s/articleView?id=sf.pages_static_resources.htm&type=5), the maximum size of a static resource is 5 MB . Therefore, if your zip file is larger than 5 MB, you cannot upload it as a single static resource.

You try using third-party file hosting service, such as Amazon S3 or Google Cloud Storage, to host the zip file and reference it in your code. This might allow you to bypass the 5 MB limit of static resources.

If it's feasible to split the ZIP file into smaller parts(https://kb.winzip.com/help/help_splitdlg.htm), you can divide it into multiple files that are within the size limits of a static resource. Then, you can store these smaller files as separate static resources and combine them at runtime when needed.

Related:
https://help.salesforce.com/s/articleView?id=ind.doc_gen_create_a_zip_file_and_upload_as_a_static_resource.htm&type=5

https://salesforce.stackexchange.com/questions/337134/is-it-more-inefficient-to-serve-a-zip-file-from-static-resouces-vs-individual-fi

If this information helps, please mark the answer as best. Thank you
Arun Kumar 1141Arun Kumar 1141

Hi Nikhil,

If the size of your zip file is larger than the maximum allowed size for a static resource in your environment, you'll need to explore alternative approaches to handle your file dependencies. Here are a few suggestions:

1. Split the file: Break down the zip file into smaller parts that fit within the size limit of the static resource. You can split the file into multiple zip files and upload them as separate static resources. Then, in your JavaScript code, you can dynamically load and merge these smaller zip files as needed.

2. External hosting: Instead of storing the zip file in a static resource, you can host it externally on a different server or cloud storage provider. Upload your zip file to a suitable hosting service (e.g., Amazon S3, Google Cloud Storage, or your own web server) and provide a public URL to access the file. Your JavaScript code can then make HTTP requests to download and use the zip file from the external location.

3. Dynamic generation: If possible, consider generating the necessary files or data dynamically instead of relying on a pre-existing zip file. Depending on your use case, you may be able to create the required resources on-the-fly using server-side logic or by leveraging APIs. This approach eliminates the need for a static resource altogether.

4. Compression and optimization: If the zip file contains assets that can be optimized, consider compressing or optimizing them further to reduce the overall size. You can use tools like image optimization libraries or minifiers for CSS and JavaScript to achieve smaller file sizes. This approach may not always be feasible, but it can help reduce the size of the resources within the zip file.

Choose the approach that best suits your specific requirements and constraints. Remember to consider factors such as maintenance, performance, and security when implementing any solution.

Hope this will be helpful.
Thanks!
Mahesh GorrepatiMahesh Gorrepati
Hi, NIkhil
 YOu can try upload the them using FIles or you can increase the size of the file by Rsiisng query to the Salexforce Customer Support.


Chech these for Further Reference
https://help.salesforce.com/s/articleView?id=000386690&type=1
https://help.salesforce.com/s/articleView?id=000386090&type=1