We have a zipped static resource (our help documentation that includes lots of images) that is of size 4,977,413 bytes when zipped using Deflater.BEST_COMPRESSION. But once converted to SFDX format, a sfdx force:source:push reports:

static resource cannot exceed 5MB

as presumably it is using a different compression algorithm.

Is the SFDX code that does the compression accessible i.e. is it somewhere in the node_modules? And if so, where is it?


I don't think this is going to be configurable any way sensibly for you. From reading the source, there seems to be a few different ways that sfdx deals with archives. From a quick read, the most likely looking culprit for you is in


which has static zipDir(dir) which I think is responsible for rezipping the exploded static resource. It in turn delegates to


Which ultimately uses https://github.com/archiverjs/node-archiver to do the actual archiving. As far as I can tell, sfdx-cli always passes in Z_BEST_COMPRESSION so not much can be done about improving the compression rate.

I don't suppose it is easy to break up the static resource into several different?

  • 1
    Thank-you for looking! I guess Java's best and the JavaScript code's best are a bit different. This ZIP will move to a documentation server in a few months time and we can work round this meanwhile. But I'll take a second look based on your observations when i have a bit of time. – Keith C Aug 16 '18 at 18:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.