I have a Electron built application that includes a ~900 MB static asset that already in a compressed format. When building in Linux this is a non-issue, but Windows builds using NSIS want to compress this file which adds a ton of build time (compression) and startup (decompression) time.
Is it possible to disable compression for specific static asset files?
We use solid compression with dictionary size 1 MB (because of differential update).
compressed format
video?
@develar In this particular case, it's a VMWare .vmdk file.
@develar Was your previous comment stating this cannot _currently_ be done? If not, is this issue enough for a feature request?
Actually, you can do it right now — exclude file and then use custom nsis script to bundle using nsis File command. But it requires deep knowledge and no step by step guide...
And actually there is also another internal issue — embedded archive is not extracted directly from exe, instead, it is copied first to temp file.
Ok... so, you definitely want this feature and it will be useful for your app, right? Are you commercial company?
Yes, and yes :)
Ok, maybe it will be implemented tomorrow CET.
Dev info: embedding data using our own loader (PE wrapper) implemented in golang is a long-term plan, but for now it is ok just to generate custom file script. Nsis is awesome... but implementing zstd/7za support in C is a very complex task, that is why own golang solution is a better.
@NuSkooler @GeometricProgress
@develar In order:
.vmdk file in $root/static. I would _like_ to be able to extract the file (to a user chosen path) in the future however.const stream = createReadStream(paths.join(__static, 'myfile.vmdk'))@NuSkooler Thanks for answer. So, I think, this feature will break you current usage and you will be forced to use process.resourcesPath in a production mode (paths.join(process.resourcesPath, "static", 'myfile.vmdk'))
What electron-builder will do: copy file AS-IS to resources/${RELATIVE_PATH_TO_FIILE} where RELATIVE_PATH_TO_FIILE it is relative path to file from current file set root (if you use default file set — it means that default file set root equals to project root).
I am not going to put this file to asar.unpacked, but need to investigate — should we to not. Maybe it will allow users to use the same code to access to such file (if asar enabled).
@GeometricProgress Ouch, actually it is NSIS problem to handle large files, not 7z.
@GeometricProgress Yeach... Windows PE is limited to 4GB. So, the only solution for you — donate us or wait when solution "golang wrapper and storing app package in the hidden area of exe file" will be implemented.
I don't want to introduce magic. If you have already compressed files (vm, vides), you should use extraResources. Otherwise such files will be included into asar archive (app.asar).
Option preCompressedFileExtensions is added. Defaults to [".avi", ".mov", ".m4v", ".mp4", ".m4p", ".qt", ".mkv", ".webm", ".vmdk"]. These files will be copied as is to installer (internally, using NSIS File command — not part of app package 7z archive).
So, as soon as you have specified such files in the extraResources:
"extraResources": ["**/*.mov"]
matching files will be copied to app resources and IF file extension matches one of the preCompressedFileExtensions, it will copied AS IS without compression.
So, @NuSkooler you need:
"extraResources": ["**/*. vmdk"] to your electron-builder config.process.resourcesPath (be aware — this property is not correct in dev mode).20.5.0 will be published today.
Thank you so much again for the quick turn-around on this. Very helpful!
Most helpful comment
I don't want to introduce magic. If you have already compressed files (vm, vides), you should use
extraResources. Otherwise such files will be included into asar archive (app.asar).Option
preCompressedFileExtensionsis added. Defaults to[".avi", ".mov", ".m4v", ".mp4", ".m4p", ".qt", ".mkv", ".webm", ".vmdk"]. These files will be copied as is to installer (internally, using NSIS File command — not part of app package 7z archive).So, as soon as you have specified such files in the
extraResources:matching files will be copied to app resources and IF file extension matches one of the
preCompressedFileExtensions, it will copied AS IS without compression.So, @NuSkooler you need:
"extraResources": ["**/*. vmdk"]to your electron-builder config.process.resourcesPath(be aware — this property is not correct in dev mode).