-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get or Specify Final Build exe or dmg file names #899
Comments
For what do you need output file name? You can use |
Consider this: //Install page for Electron Application
router.get('/electron', function(req, res, next){
const promise = electronBuilder
.buildPromise()
.then(() => {
const file = electronBuilder.outputFilename;
const data = fs.readFileSync(`${electronBuilder.outputPath}/${file}`);
res.setHeader('Content-Disposition', `attachment; filename="${file}"`);
if(file.substr(file.length - 3) === "exe")
res.setHeader('Content-type', 'application/exe, application/octet-stream');
else if (file.substr(file.length - 3) === "dmg")
res.setHeader('Content-type', 'application/dmg, application/octet-stream');
res.send(data);
}).catch((error) => {
console.error(error);
});
}); What I am doing is calling the builder trigger by the user, say, clicking a Download button. After the builder is done I want to send the file back over the response. I do that by recreating the file name like this inside //Have to recreate output file path
let outputPath = devMetadata.directories.output;
let outputFilename = `${devMetadata.build.productName} Setup ${packagejson.version}`;
if (Platform.current().name === "windows")
outputFilename += ".exe";
else if(Platform.current().name === "mac")
outputFilename += ".dmg"; I would be much more comfortable getting the file name directly from the source (i.e. If I can actually specify the final file name as an input parameter in, say, |
|
That would be great if it is some kind of pass argument. Thanks for the help! Ernie |
Works great, thanks for adding it! |
I tried to test out my app in Unbutu (was using windows before) and get an error during npm install:
Let me know if you need any more details on it. |
Doing programmatic builds in JavaScript. I would like to be able to get the output file name somehow. I can concatenate the properties but that is assumption based and would rather know definitely what the final file_name.exe is. It would be nice to actually specify it somehow. I posted a question on StackOverflow: http://stackoverflow.com/questions/40549421/retrieve-or-specify-output-file-name-in-electron-builder
Thanks
Ernie
The text was updated successfully, but these errors were encountered: